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 |
|
satish.gorijala
Posting Yak Master
182 Posts |
Posted - 2009-01-22 : 08:35:38
|
| Table1A B 1 2 3q p a b cw r e e gTable2A B P Q 1 2 3 Fq p e g - - - pe r g l - - - kI want to update the columns 1,2,3 in Table2 whereTable1.A = Table2.A and Table1.B = Table2.BHow can we frame query?G. Satish |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2009-01-22 : 08:38:31
|
| [code]update t2set [1]=t1.[1],[2]=t1.[2],[3]=t1.[3]from table1 t1 join table2 t2 on t1.A = t2.A and t1.B = t2.B[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-22 : 08:40:29
|
UPDATE t2SET t2.[1] = t1.[1], t2.[2] = t1.[2], t2.[3] = t1.[3]FROM Table2 AS t2INNER JOIN Table1 AS t1 ON t1.A = t2.A AND t1.B = t2.B E 12°55'05.63"N 56°04'39.26" |
 |
|
|
satish.gorijala
Posting Yak Master
182 Posts |
Posted - 2009-01-22 : 09:00:02
|
Thank You. I thought inner join wont work with update.quote: Originally posted by Peso UPDATE t2SET t2.[1] = t1.[1], t2.[2] = t1.[2], t2.[3] = t1.[3]FROM Table2 AS t2INNER JOIN Table1 AS t1 ON t1.A = t2.A AND t1.B = t2.B E 12°55'05.63"N 56°04'39.26"
G. Satish |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-22 : 09:16:00
|
| why didnt you refer to books online to check it? for syntax related queries, books online should be first resort |
 |
|
|
|
|
|