oracle10g - SQL Query Start and End Date -
This is slightly different from this:
And I do not know how to I suck in English
table
name. Date Foo | 1-Sep Foo | 2-Sep Fu | 3-Sep Foo | 5-Sep Foo | 6-Sep Fu | 7-Sep Foo | 1-Dec Fu | 2-Dec Fu | 4-Dec Fu | 5-Dec Foo | 6-Dec Fu | 7-Dec Fu | 8-Dec Fu | February 1-Fu | February 14 FU | February 15 FU | February 16 Fu | February 17 FU | February 18 FU | February 19 Fu | February 20 FU | 22-February I need to create a query with the following result
query results
names | Start date Last date fu | 1-Sep | 3-Sep Foo | 5-Sep | 7-Sep Foo | 4-Dec | 8-Dec Fu | February 1 | February 1-Fu | 1-Dec | 2-Dec Fu | 14-Feb | February 20 FU | February 22 | 22-Feb Update:
- Start date: The 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 the series of consecutive days, as above 22 February, the beginning and end Date
Not sure what's the best way to do it first You can filter the dates that are the previous and next day, you can use the solution explained in
which filters out unimportant dates:
Select t1.Name, date from date T1 to date left in the table in T2 (D, -1, T1) = T2. The dates add to the external date (D, 1, T.Det) = T. 3.Detter where T.Det blank or T3 Date is zero
Comments
Post a Comment