Untitled

user_1196610317 avatar
user_1196610317
mysql
11/24/2021 8:24 AM
516 B
15
Indexable
SELECT Start_date, MIN(End_Date) as final FROM
(SELECT A.Start_Date FROM Projects A LEFT JOIN Projects B ON A.Start_Date = B.End_Date WHERE B.Task_ID is null) AS Starts JOIN
(SELECT A.End_Date FROM Projects A LEFT JOIN Projects B ON A.End_Date = B.Start_Date WHERE B.Task_ID is null) AS Ends
 ON Start_Date < End_Date
GROUP BY Start_date
ORDER BY MIN(End_date) - Start_date,Start_date;
Editor is loading...