Skip to content
Advertisement

How to join two tables to determine date ranges when one table contains (id, start_date) and another contains (id, end_date)

I’m new to SQL, hope you guys don’t find it silly. Working with two tables here, one contains start dates and other contains end dates. Entries do not follow sequence/possibility of duplicates.

Advertisement

Answer

You can use union all and aggregation with some window functions:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement