Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dirwin26
Yak Posting Veteran
81 Posts |
Posted - 2005-12-14 : 18:09:26
|
| I want to take column B and shift it down one valueHere's what I have:Thedate----ColA----ColBtoday------1--------2tomorrow---2--------XXHere's where I want to get to:Thedate----ColA----ColBtoday------1--------XXtomorrow---2--------2Does anyone know how to do this??Thanks |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-15 : 02:20:31
|
| Where do you want to show these data?If you use Front End application, show these thereMadhivananFailing to plan is Planning to fail |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2005-12-15 : 02:40:36
|
quote: Here's what I have:Thedate----ColA----ColBtoday------1--------2tomorrow---2--------XXHere's where I want to get to:Thedate----ColA----ColBtoday------1--------XXtomorrow---2--------2
What are you trying to achieve ?Are you swaping the ColB's value for today and tomorrow ?Your sample data is too few to understand your requirement.-----------------[KH]Learn something new everyday |
 |
|
|
dirwin26
Yak Posting Veteran
81 Posts |
Posted - 2005-12-15 : 10:23:09
|
| By shifting the data down one row, which in this case does matter b/c the primaryKey col is dates, I can assign a closing value of today to tomorrow. This gets it done. update #resset dateb = dateadd(day,1,thedate) update #resset colb = r1.colafrom #res r1where r1.dateb = #res.thedate |
 |
|
|
|
|
|