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

Update previous record based on next record

$
0
0

Hi All,

I have data like this

Orderid  Orderstatus  startdate            Enddate

1            Ordered       2005-01-01       null

1            Shipped       2005-02-01       null

1            Delivered     2005-03-01       null

from above table I have to do select statement to populate enddate

output should be

Orderid  Orderstatus  startdate            Enddate

1            Ordered       2005-01-01       2005-02-01

1            Shipped       2005-02-01       2005-03-01

1            Delivered     2005-03-01       2005-03-01

Please help me to get select statement to get result as above.

Any help is very much appreciated


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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