Let\'s say I have a table with two columns: start and end, both integers, and the table is ordered by the first, then second column. Each row repr
In your links you have omitted one: Can I use a SQL Server CTE to merge intersecting dates? where I present a RECURSIVE CTE solution to the overlapping intervals problem. Recursive CTE's can be handled differently (compared to ordinary self-joins), and often perform amazingly fast.
mysql does not have recursive CTEs. Postgres has them, Oracle has them, Microsoft has them.
Here Querying for a 'run' of consecutive columns in Postgres is another one, with a fudge-factor.
Here Get total time interval from multiple rows if sequence not broken is yet another one.