MySQL - Merge overlapping date intervals
Found in [https://stackoverflow.com/questions/2561130/merge-overlapping-date-intervals]
Merge overlapping date intervals
Is there a better way of merging overlapping date intervals?
The solution I came up with is so simple that now I wonder if someone else has a better idea of how this could be done.
(...)
|
12
|
I was looking for the same solution and came across this post.
There is also another thread here.
I tested this with various date ranges including the ones listed here and it works correclty every time.
The result is:
StartDate | EndDate
2010-01-01 | 2010-06-13 2010-06-15 | 2010-06-25 2010-06-26 | 2010-08-16 2010-11-01 | 2010-12-31 | ||||||||||||
|