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 |
|
hspatil31
Posting Yak Master
182 Posts |
Posted - 2012-04-24 : 05:57:06
|
| Dear All,I want to update ColumnC from Table1. On the basis,CalumnA and ColumnB should be match and then update ColumnC in Table1 from the ColumnC value from Table2. Can anybody please tell me the SQL statement for this ?Table1:ColumnA ColumnB ColumnCTable2:ColumnA ColumnB ColumnCThanks and Regard'sHarish Patil |
|
|
vinu.vijayan
Posting Yak Master
227 Posts |
Posted - 2012-04-24 : 06:35:06
|
| Please post some sample data so that we can understand what you're requirement is.What do you mean by "On the basis, CalumnA and ColumnB should be match"?Which "CalumnA and ColumnB" are you talking about??...The ones in Table1 or the ones in Table2 or do you want to compare the columns in both tables??....Please be a more precise about your requirement and please post some sample data.N 28° 33' 11.93148"E 77° 14' 33.66384" |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-04-24 : 07:00:39
|
update t1set ColumnC = t2.ColumnCfrom Table1 as t1join Table2 as t2 on t2.ColumnA = t1.ColumnA and t2.ColumnB = t1.ColumnB No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-24 : 21:34:32
|
| i hope the relationship between tables is 1- to -1------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|