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 |
|
Ali T
Starting Member
22 Posts |
Posted - 2008-11-26 : 10:47:22
|
| Dear allI have a table called "Trans" two columns called ID and A.I have another table called "R" with two columns called "ID" and "B".the IDs are the same.I want to write a query which checks the content of each cell of Column A from table "Trans" and then if the number in it is more than 0 update The corresponding cell ofColumn "B" in table " R" with "1".I'd appreciate it if you help me with this matter.RegardsAli |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-26 : 12:02:08
|
just a simple join will doUPDATE rSET r.B=CASE WHEN t.A>0 THEN 1 ELSE 0 ENDFROM R rJOIN Trans tON t.ID=r.ID |
 |
|
|
Ali T
Starting Member
22 Posts |
Posted - 2008-11-26 : 16:39:43
|
| Dear visakh16Problem solved. I'm Really thankful!Ali |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-27 : 04:09:46
|
welcome |
 |
|
|
|
|
|