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 code will work for any case. I think people are complicating this. Valid start dates are all start dates filtered out with any end dates that match. Valid end dates are all end dates filtered out with any start dates that match. Once you realize this, the solution is simply creating a list of start dates filterd out by end dates that match and then attaching the min valid end date > that valid start date. row_number() is not necessary.
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 code will work for any case. I think people are complicating this. Valid start dates are all start dates filtered out with any end dates that match. Valid end dates are all end dates filtered out with any start dates that match. Once you realize this, the solution is simply creating a list of start dates filterd out by end dates that match and then attaching the min valid end date > that valid start date. row_number() is not necessary.