SQL Date Range Split
问题 Can you please let me know the SQL to split date ranges when they overlap? Data (sample data with a date range and possibly other columns): Col1 FromDate ToDate 1. 1 1/1/2008 31/12/2010 2. 1 1/1/2009 31/12/2012 3. 1 1/1/2009 31/12/2014 Output: Col1 From Date ToDate 1. 1 1/1/2008 31/12/2008 (from row 1 above) 2. 1 1/1/2009 31/12/2010 (from rows 1,2 and 3 above) 3. 1 1/1/2011 31/12/2012 (from rows 2 and 3 above) 4. 1 1/1/2013 31/12/2014 (from row 3 above) 回答1: This should do the trick (MySQL