SELECT ep.schedstatus, bk.LDate, ce.Comments, c.clientid,
c.LastName,es.EvStrName 'Run',
ep.City 'P/U City', p.polyname 'P/U County',
ed.City 'Drop-off City',
ed.AddrName 'Facility Name'
FROM Events ep, Events ed, EventStrings es, Clients c,
BookingLegs bl, Booking bk, polygons p, address a,
ClientEligConditions ce
WHERE ep.schedstatus = 3 AND ep.SchId > 288 and ep.SchId < 654
AND ed.SchId = ep.SchId AND ep.Activity = 0 AND ed.Activity = 1
AND ed.BookingId = ep.BookingId AND es.SchId = ep.SchId
AND es.EvStrId = ep.EvStrId
AND c.ClientId = ep.ClientId
AND ep.ClientId = ce.ClientId
AND bl.LegId = ep.LegId
and a.AddrType = CH
and c.DateofBirth > 19871231 and c.DateofBirth < 19940101
and a.jurispolyid in ('3', '4','7','43','66') and a.jurispolyid = p.polyid
AND ed.BookingId = bk.BookingId
ORDER BY c. DateofBirth, p.polyname, bk.LDate, es.EvStrName
The SQL Query listed above was created from putting together elements
Of other existing SQL queries from the Kid One Transport database.
Trial and error methodology was used since no data dictionary was made
available at the time the query was written.
Management Report Summary
After running this SQL query the results were as follows:
The date filter (DOB > 19871231 and DOB < 19940101) shows 23
prenatal clients transported in the age range of 14-17 years old during
the 2005 calendar year.
The SQL code to isolate the 2005 calendar year was:
ep.SchId > 288 and ep.SchId < 654
A total of 255 trips were made in 2005 by these 23 clients, some had
more trips than others.