SQL - combine consecutive date rows based on column
Let's say I have the following SQL result BegDate | EndDate | quanitty 1/1/2014 1/31/2014 1 2/1/2014 2/28/2014 1 3/1/2014 3/31/2014 2 4/1/2014 4/30/2014 4 5/1/2014 5/31/2014 4 6/1/2014 6/30/2014 4 7/1/2014 7/31/2014 2 8/1/2014 8/30/2014 2 I need to group all months with the same quantity into one row so the result should be BegDate | EndDate | quanitty 1/1/2014 2/28/2014 1 3/1/2014 3/31/2014 2 4/1/2014 6/30/2014 4 7/1/2014 8/30/2014 2 I've searched around stackoverflow and found similar posts which solution's I've tried to no avail This and This The following is the SQL i'm using to create the