You are viewing a single comment's thread. Return to all comments →
with cte as (select p.*, row_number() over (order by start_date) as rn, end_date - row_number() over (order by start_date) as diff from projects p), cte_2 as (select distinct min(cte.start_date) over (partition by cte.diff) as start_date, max(cte.end_date) over (partition by cte.diff) as end_date, count(*) over (partition by cte.diff) as completion_time from cte order by count(*) over (partition by cte.diff), min(cte.start_date) over (partition by cte.diff)) select cte_2.start_date, cte_2.end_Date from cte_2 order by cte_2.completion_time , cte_2.start_date;
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 →