query calculation needed
Posted on 2014-02-06
I have two tables, one that has scheduling info (PatientID, Date), and another table that has dates when the patient is authorized to have schedule (PatientID, DateFrom, DateTo).
I need a query that gives me all unauthorized schedules,
for example if a patient is authorized to have from 1/1/14 to 1/15/14, and had schedule prior to 1/1/14 or after 1/15/14, those schedule records i would like to see,
one more point, a patient can have more then one entry in the authorization table.
like in addition to 1/1/14 - 1/15/14, they can also have 1/25/14 - 1/31/14 and so on..