We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
with
projects_group
as
(
select
start_date,
end_date,
end_date - row_number() over(order by end_date) pj_gr
from
Projects
)
select
min(start_date) pj_start_date,
max(end_date) pj_end_date
from
projects_group
group by
pj_gr
order by
max(end_date) - min(start_date), pj_start_date;
Cookie support is required to access HackerRank
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 →
with projects_group as ( select start_date, end_date, end_date - row_number() over(order by end_date) pj_gr from Projects ) select min(start_date) pj_start_date, max(end_date) pj_end_date from projects_group group by pj_gr order by max(end_date) - min(start_date), pj_start_date;