You are viewing a single comment's thread. Return to all comments →
MSSQL solution:
with starts as ( select p.* , case when p.start_date = lag(p.end_date, 1, null) over (order by p.start_date) then 0 else 1 end as proj_start from projects p ) , grps as ( select start_date , end_date , sum(proj_start) over (order by start_date asc) as grp_num from starts ) select min(start_date) ,max(end_date) from grps group by grp_num order by datediff(day, min(start_date), max(end_date)) asc, min(start_date) 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 →
MSSQL solution: