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.
SELECTStart_Date,MIN(End_Date)FROM/* Choose start dates that are not end dates of other projects (if a start date is an end date, it is part of the samee project) */(SELECTStart_DateFROMProjectsWHEREStart_DateNOTIN(SELECTEnd_DateFROMProjects))a,/* Choose end dates that are not end dates of other projects */(SELECTend_dateFROMPROJECTSWHEREend_dateNOTIN(SELECTstart_dateFROMPROJECTS))b/* At this point, we should have a list of start dates and end dates that don't necessarily correspond with each other *//* This makes sure we only choose end dates that fall after the start date, and choosing the MIN means for the particular start_date, we get the closest end date that does not coincide with the start of another task */wherestart_date<end_dateGROUPBYstart_dateORDERBYdatediff(start_date,MIN(end_date))DESC,start_date
SQL Project Planning
You are viewing a single comment's thread. Return to all comments →
Just adding this commented version. MySQL