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 |
|
AbuAnas
Starting Member
4 Posts |
Posted - 2004-10-24 : 06:54:05
|
| Hi. Assuming that I have the following schemat1(id, filed)t2(id, filed)t3(id, ref)I want to update ALL the values in t3.ref to be equal t1.id whenever t3.ref=t2.id and t1.field = t2.field In other words I would like to update all refs in t3 to be equal to id's in t1 insted of id's of t2 whenever the filed cloumns match in t1 and t2 What is the correct SQL statment to be used (or tool if any). I am using MS SQLThanx |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-10-24 : 13:09:20
|
I want to update ALL the values in t3.ref to be equal t1.id whenever t3.ref=t2.id and t1.field = t2.field will this work for you?update t3set ref = t1.idfrom table3 t3 inner join table2 t2 on t3.ref = t2.idinner join table1 t1 on t1.field = t2.fieldGo with the flow & have fun! Else fight the flow |
 |
|
|
|
|
|