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.
My solution in MySQL with no need to change sql_mode:
select Start_Date, min(End_Date) from
(select Start_Date from Projects where Start_Date not in (select End_Date from Projects)) s
cross join
(select End_Date from Projects where End_Date not in (select Start_Date from Projects)) e
where Start_Date < End_Date
group by Start_Date order by DATEDIFF(min(End_Date),Start_Date),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 →
My solution in MySQL with no need to change sql_mode:
select Start_Date, min(End_Date) from (select Start_Date from Projects where Start_Date not in (select End_Date from Projects)) s cross join (select End_Date from Projects where End_Date not in (select Start_Date from Projects)) e where Start_Date < End_Date group by Start_Date order by DATEDIFF(min(End_Date),Start_Date),Start_Date;