JohnMac328
asked on
SQL calaulate start time and end time between a date range
I need to calculate a start and end time between a date range. This gives the date range and the different times. I need Patient.AnesStartTime and Patient.EndStartTime calculated to show how much time for each patient between the date range.
SELECT AnesStaff.AnesLastName, AnesStaff.AnesFirstName, Service.Service, Service.MEPERSCode, AnesStaff.FlagRelief, Patient.DateSurgery, Patient.AnesStartTime,
Patient.AnesEndTime
FROM Service INNER JOIN
AnesStaff ON Service.PatientID = AnesStaff.PatientID INNER JOIN
Patient ON Service.PatientID = Patient.PatientID AND AnesStaff.PatientID = Patient.PatientID
WHERE (Patient.DateSurgery BETWEEN CONVERT(DATETIME, '2008-03-01 00:00:00', 102) AND CONVERT(DATETIME, '2008-04-01 00:00:00', 102))
Thanks
SELECT AnesStaff.AnesLastName, AnesStaff.AnesFirstName, Service.Service, Service.MEPERSCode, AnesStaff.FlagRelief, Patient.DateSurgery, Patient.AnesStartTime,
Patient.AnesEndTime
FROM Service INNER JOIN
AnesStaff ON Service.PatientID = AnesStaff.PatientID INNER JOIN
Patient ON Service.PatientID = Patient.PatientID AND AnesStaff.PatientID = Patient.PatientID
WHERE (Patient.DateSurgery BETWEEN CONVERT(DATETIME, '2008-03-01 00:00:00', 102) AND CONVERT(DATETIME, '2008-04-01 00:00:00', 102))
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks again
ASKER