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 PSEQ AS (SELECT
Task_ID,
Start_Date,
End_Date,
DATE_SUB(Start_Date,INTERVAL (ROW_NUMBER() OVER (ORDER BY Start_Date)) DAY) AS PGroup
FROM
Projects)
SELECT
MIN(Start_Date) AS PStart,
MAX(End_Date) AS PEnd
FROM
PSEQ
GROUP BY
PGroup
ORDER BY COUNT(*) ASC, MIN(Start_Date) ASC
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 PSEQ AS (SELECT Task_ID, Start_Date, End_Date, DATE_SUB(Start_Date,INTERVAL (ROW_NUMBER() OVER (ORDER BY Start_Date)) DAY) AS PGroup FROM Projects)