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 |
venkatch786
Starting Member
8 Posts |
Posted - 2010-08-20 : 08:06:54
|
Hi,I have table1 having OrgID and Value1 columns and another table2 having OrgID and districts columnsone more table3 having value2 and districts columns.I want to Update table1 value1 with table3 value2 for each districts for same OrgIDHere OrgID is Unique and districts are duplicateThanks in Advance |
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-08-20 : 08:19:53
|
UPDATE table1 SET value1 = a.value2FROM table1 t1INNER JOIN (SELECT distinct orgID, districts, value2 FROM table2 t2 INNER JOIN table3 t3 ON t2.districts = t3.districts) a ON t1.OrgID = a.OrgIDVaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-08-20 : 08:24:16
|
quote: Originally posted by vaibhavktiwari83 UPDATE t1SET value1 = a.value2FROM table1 t1INNER JOIN (SELECT distinct orgID, districts, value2 FROM table2 t2 INNER JOIN table3 t3 ON t2.districts = t3.districts) a ON t1.OrgID = a.OrgIDVaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER
You need to use alias nameMadhivananFailing to plan is Planning to fail |
|
|
|
|
|