SQL Project Planning

  • + 0 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)

    SELECT
        MIN(Start_Date) AS PStart,
        MAX(End_Date) AS PEnd
    FROM
        PSEQ
    GROUP BY
        PGroup
    ORDER BY COUNT(*) ASC, MIN(Start_Date) ASC