Results 1 to 2 of 2
Thread: complicated excluding of records
2009-04-05, 04:24 #1
- Join Date
- Mar 2004
- Thanked 0 Times in 0 Posts
Hi, I have been asked to produce a report on client appointment information, between a certain date range - which is simple enough on it's own (1 client can have many appointments). However the complication is that they want to EXCLUDE appointment dates based on dates in another table - placements, where 1 client can have many placements. Placements have a start and end date, and a client can have multiple placements, it can be assumed that they don't overlap. So I want to exclude appointments that take place during any placement, but include appointments between any 2 placements.
Is this even possible? If it is, could someone please offer guidance on how to construct the query? Thank you.
2009-04-05, 05:28 #2
- Join Date
- Mar 2002
- Thanked 28 Times in 28 Posts
You can first create a query based on the appoinments and placements tables that selects all appointments that fall within a placement.
Then create a query based on the appointments table and on the first query that selects the appointments that don't occur in the first query.
See the attached sample database.