I have data like this
ID StartDate EndDate DesigCode FacilityID
------------------------------------------------------------
1 1-Jan 2015 1-Feb 2015 1 1
2 3-Feb 2015 10-Mar 2015 1 2
3 5-Apr 2015 3-June 2015 2 1
4 2-Jul 2015 6-Aug 2015 3 1
5 15-Sep 2015 30-Oct 2015 3 4
6 14-Nov 2015 1-Dec 2015 1 4
I want a query that result, earliest date of consecutive same value in DesigCode
column.
ID StartDate EndDate DesigCode FacilityID
------------------------------------------------------------
1 1-Jan-2015 1-Feb 2015 1 1
3 5-Apr 2015 3-June 2015 2 1
4 2-Jul 2015 6-Aug 2015 3 1
6 14-Nov 2015 1-Sec 2015 1 4
I have no idea about this query.