I need help to write a query like below oupt put.
create table #table (id int, cid int , startdate datetime)
insert #table
select 1, 100, '02/23/2014'
union select 1, 100, '06/25/2013'
union select 1, 100, '06/04/2013'
union select 1, 100, '06/17/2013'
union select 2, 200, '08/9/2013'
union select 2, 200, '08/3/2013'
First date 02/23/2014...So heere I need only the 2013 Current End dates Based On Start Date...
I need oupt put like below table based on above table.
id cid start_date end_date
1 100 02/23/2014 --
1 100 06/25/2013 12/31/2013
1 100 06/04/2013 06/24/2013
1 100 06/17/2013 06/03/2013
2 200 08/9/2013 12/31/2013
2 200 08/03/2013 08/08/2013
Thanks,