Find the Start and End Number of Continuous Ranges
SQL walkthrough: sort the unique ids, subtract each id’s position to get a shared key for every unbroken run, then report each run’s first and last id. The sample ids are invented.
SQL walkthrough: sort the unique ids, subtract each id’s position to get a shared key for every unbroken run, then report each run’s first and last id. The sample ids are invented.