Separating date ranges into separate segments in SQL
- by Richard
I have a table containing 2 date fields and an identifier (id, fromdate and todate) These dates overlap in any and every possible way. I need to produce a list of segments each with a start and end date describing the separate segments in that list.
For example:
id, FromDate ToDate
1, 1944-12-11, 1944-12-31
2, 1945-01-01, 1945-12-31
3, …