This is slightly different than this: SQL Query Creating Start and End Dates
And I do not know how to phrase this question as I suck in English.
Table
Name | Date
Foo | 1-Sep
Foo | 2-Sep
Foo | 3-Sep
Foo | 5-Sep
Foo | 6-Sep
Foo | 7-Sep
Foo | 1-Dec
Foo | 2-Dec
Foo | 4-Dec
Foo | 5-Dec
Foo | 6-Dec
Foo | 7-Dec
Foo | 8-Dec
Foo | 1-Feb
Foo | 14-Feb
Foo | 15-Feb
Foo | 16-Feb
Foo | 17-Feb
Foo | 18-Feb
Foo | 19-Feb
Foo | 20-Feb
Foo | 22-Feb
I need to create a query with the below result
Query Result
Name | Start Date | End Date
Foo | 1-Sep | 3-Sep
Foo | 5-Sep | 7-Sep
Foo | 4-Dec | 8-Dec
Foo | 1-Feb | 1-Feb
Foo | 1-Dec | 2-Dec
Foo | 14-Feb | 20-Feb
Foo | 22-Feb | 22-Feb
Update:
- Start Date: First day of a series of consecutive days
- End Date: Last day of a series of consecutive days
- If a date is not included in a series of consecutive days, like Feb 22 above, it is the start and end date.