T SQL Script: BACAS Get All Cremations
T SQL Script: BACAS Get All Cremations
SELECT TOP 100 PERCENT
dbo.tblMainLocation.[Description] AS Location,
tblResource.[Description] AS Diary,
dbo.tblAppointmentLink.CBID AS CremationRef,
dbo.tblClient.Forenames AS DeceasedForenames,
dbo.tblClient.[Surname of Father] AS DeceasedSurname,
dbo.tblAppointmentLink.[Appointment Date] AS AppointmentDate,
dbo.tblAppointmentLink.[Appointment Time] AS AppointmentTime
FROM dbo.tblAppointmentLink
INNER JOIN dbo.tblMainLocation
ON dbo.tblAppointmentLink.MainLocationId = tblMainLocation.ID
LEFT JOIN tblResource
ON dbo.tblAppointmentLink.[Diary ID] = tblResource.ID
LEFT JOIN tblClient
ON dbo.tblAppointmentLink.[Client ID] = dbo.tblClient.ID
WHERE dbo.tblAppointmentLink.AppointmentType = 1301
ORDER BY AppointmentDate, AppointmentTime, Location;
dbo.tblMainLocation.[Description] AS Location,
tblResource.[Description] AS Diary,
dbo.tblAppointmentLink.CBID AS CremationRef,
dbo.tblClient.Forenames AS DeceasedForenames,
dbo.tblClient.[Surname of Father] AS DeceasedSurname,
dbo.tblAppointmentLink.[Appointment Date] AS AppointmentDate,
dbo.tblAppointmentLink.[Appointment Time] AS AppointmentTime
FROM dbo.tblAppointmentLink
INNER JOIN dbo.tblMainLocation
ON dbo.tblAppointmentLink.MainLocationId = tblMainLocation.ID
LEFT JOIN tblResource
ON dbo.tblAppointmentLink.[Diary ID] = tblResource.ID
LEFT JOIN tblClient
ON dbo.tblAppointmentLink.[Client ID] = dbo.tblClient.ID
WHERE dbo.tblAppointmentLink.AppointmentType = 1301
ORDER BY AppointmentDate, AppointmentTime, Location;