You are viewing a single comment's thread. Return to all comments →
WITH difference AS ( SELECT start_date, end_date, @group := IF(@prev_end = start_date, @group, @group + 1) AS grp, @prev_end := end_date FROM projects, (SELECT @prev_end := NULL, @group := 0) vars ORDER BY 1 ) SELECT MIN(start_date) AS start_date, MAX(end_date) AS end_date FROM difference GROUP BY grp ORDER BY count(grp), 1;
SQL Project Planning
You are viewing a single comment's thread. Return to all comments →