Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
335 B
2
Indexable
Never
SELECT start_date, MIN(end_date)FROM 
(SELECT start_date FROM projects WHERE start_date NOT IN (SELECT end_date FROM projects)) P,
(SELECT end_date FROM projects WHERE end_date NOT IN (SELECT start_date FROM projects)) Q
WHERE end_date > start_date GROUP BY start_date ORDER BY datediff(start_date, MIN(end_date)) DESC, start_date ASC;