Click here to Skip to main content
15,899,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I Want To Update Multiple Columns Of Multiple Table Using Joins.
Updating One Column Or Multiple Column Of Single Table With Join Is Easy,
But I Am Not Getting Any Solution For This.
Posted
Comments
Sprint89 1-Jul-14 3:30am    
You will need a separate update query for each table, are you trying to use one update for more than one table?
Anudeep Jaiswal - MCA 2-Jul-14 4:52am    
Yes I Want The Same...
but I Think Not Possible...

If you intend to update columns of one table from columns of another table that have common keys, here's how you can do it. Note that this is SQL Server syntax. Other databases like Oracle and MySQL may have different syntax.

SQL
UPDATE T1
SET T1.Col1 = T2.COl1, T1.Col2 = T2.Col2
FROM T2 ON T1.Key1 = T2.Key1
WHERE .........
 
Share this answer
 
Comments
Anudeep Jaiswal - MCA 1-Jul-14 5:11am    
I Want To Update T1 And T2 Table Both In A Single Query.
You cannot update multiple tables in one update query, but you can placed them in a transaction as shown: how-to-update-multiple-tables-in-sql-server[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900