Untitled

 avatar
user_9914919852
mysql
3 years ago
336 B
1
Indexable
SELECT Start_Date, MIN(End_Date)
FROM 
(SELECT Start_Date FROM Projects WHERE Start_Date NOT IN (SELECT End_Date FROM Projects)) a,
(SELECT End_date FROM Projects WHERE End_date NOT IN (SELECT start_date FROM Projects)) b
WHERE Start_date < End_date GROUP BY Start_date
ORDER BY DATEDIFF(Start_date, MIN(End_date)) DESC, Start_date