February 5, 2014 at 4:53 pm
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,
February 5, 2014 at 4:58 pm
duplicate post, please post replies at this post instead http://www.sqlservercentral.com/Forums/Topic1538410-392-1.aspx
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy