Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Query to split one row to multiple based on date range

$
0
0

Hi,

I need to split single row into multple based on date range defined in a column, start_dt and end_dt

I have a data

ID      From date             End_dt                measure

1        2013-12-01         2013-12-03            1

1        2013-12-04         2013-12-06            2

2        2013-12-01         2013-12-02            11

3        2013-12-03         2013-12-04          22

I required output as

ID      Date                      measure

1        2013-12-01              1

1        2013-12-02              1

1        2013-12-03              1

1        2013-12-04              2

1        2013-12-05              2

1        2013-12-06              2

2        2013-12-01             11

2        2013-12-02             11

3        2013-12-03             22

3        2013-12-04            22

Please provide me sq, query for the same


Amit
Please mark as answer if helpful
http://fascinatingsql.wordpress.com/


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>