Re: Combining 2 tables with date ranges
Your sample data is a mess, but the usual way is to build a calendar
and join these improperly designed tables together with BETWEEN
predicates, something like:
SELECT C.cal_date, T1.a, T2.b, ..
FROM Calendar AS C, T1, T2
WHERE C.cal_date BETWEEN T1.start_date AND T1.end_date
AND C.cal_date BETWEEN T2.start_date AND T2.end_date
AND .. ;
MIssing or reversed data will not be shown in this query.
.
Relevant Pages
- Re: Im so relieved.
... This would have been a big mess if it really had been wrong! ... I have a hotel ... saved both days on her calendar. ... So I run upstairs to get the contract, yes, the 12th and 13th. ... (rec.crafts.textiles.quilting) - Re: Shared calendars - for all users by default?
... mess if I did it that way. ... >Why do not create a Public Folder with a general Calendar ... >> I am implementing a new mail domain on a Windows ... >> I see where I can give them full control to the entire ... (microsoft.public.exchange.admin) - Re: Why Javas Time related classes are so confusing and error-prone?
... Calendar is poetry by comparison, ... agree it is a mess. ... I wrote BigDate in self defence. ... (comp.lang.java.programmer) - Re: query help
... sample data, I am assuming you have the data specific to Donations, Prayer ... Using a calendar ... You can simplify them using CASE expressions if the referencing columns ... (microsoft.public.sqlserver.programming) - Re: Multiple instances of calendar events in Entourage
... the calendar events in Entourage are showing up three times over. ... Categories will not sync so all events without one are duplicates. ... lot easier to clean the whole mess up. ... (microsoft.public.mac.office.entourage) |
|