Functional Questions
SELECT PatientID
, FirstName
, LastName
FROM Patient
WHERE PracticeID IN (SELECT PracticeID
FROM Practice
WHERE PracticeTypeID = 'DSO')
SELECT PatientID
, FirstName
, LastName
, (SELECT MAX(AppointmentDate)
FROM Appointment
WHERE Appointment.PatientID = Patient.PatientID)
FROM Patient
WHERE PracticeID = 43
__________________(@PracticeName)
SELECT SalesOrderID
, (SELECT Name
FROM Sales.SalesTerritory
WHERE TerritoryID = TerritoryID)
AS TerritoryName
FROM Sales.SalesOrderHeader