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 |
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2009-03-03 : 09:55:59
|
i have table Table1# Code flage Status1 1 3 02 1 4 1 3 2 3 Null4 2 4 1 5 3 3 0 i want that status in row 1 like row 2 1status in row 3 like row 4 1# Code flage Status1 1 3 12 1 4 1 3 2 3 14 2 4 1 5 3 3 0
|
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2009-03-03 : 12:26:55
|
| sorry, i think that is understood.i update rows that their flage=3, and it get status of flag=4.like row 1 it join by code .row 1 and row 2 are join,cause the have same code. so row 1 get the status of row 2.something like that:UPDATE TABLE1SET t1.tatus=t2.StatusFROM TABLE1 t1WHERE t1.Status=3 And t1.Code IN (SELECT t2.Code FROM Table1 t2 WHERE t1.Code=t2.Code) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-03 : 12:29:51
|
| [code]UPDATE t1SET t1.Status=t2.StatusFROM Table1 t1JOIN Table1 t2ON t2.Code=t1.CodeWHERE t1.flage=3AND t2.flage=4[/code] |
 |
|
|
|
|
|