You are viewing a single comment's thread. Return to all comments →
MySQL query :
with cte as ( Select start_date,end_date from projects order by start_date asc )
,cte2 as ( Select *, end_date - row_number() over (order by start_date) as id from cte )
,cte3 as ( Select min(start_date) as start_datemin,max(end_Date) as end_datemax, max(end_Date)-min(start_date) as delay from cte2 group by id )
Select start_datemin,end_datemax from cte3 order by delay asc, start_datemin asc
Seems like cookies are disabled on this browser, please enable them to open this website
SQL Project Planning
You are viewing a single comment's thread. Return to all comments →
MySQL query :
with cte as ( Select start_date,end_date from projects order by start_date asc )
,cte2 as ( Select *, end_date - row_number() over (order by start_date) as id from cte )
,cte3 as ( Select min(start_date) as start_datemin,max(end_Date) as end_datemax, max(end_Date)-min(start_date) as delay from cte2 group by id )
Select start_datemin,end_datemax from cte3 order by delay asc, start_datemin asc