Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Can we update 2 table by inner join.
Posted
Updated 21-Mar-12 18:34pm
v2
Comments
Prasad_Kulkarni 21-Mar-12 6:00am    
Explain some more,Not clear
Rajesh Anuhya 21-Mar-12 9:24am    
Not clear, can you elaborate it more..
--RA

Do two updates in one transaction.
 
Share this answer
 
Comments
Rajesh Anuhya 21-Mar-12 9:26am    
5!, Good answer, Provide a link to the OP, so that he can understand easily.
--RA
Mas11 24-Mar-12 3:12am    
Yes bro i want to Do two updates in one transaction.
Mas11 24-Mar-12 3:12am    
but only via inner join
SQL
UPDATE table1
SET Field1 = t2.Field1
FROM table1 t 
INNER JOIN table2 t2 ON t.ID = t2.ID
 
Share this answer
 
Comments
Mas11 21-Mar-12 8:45am    
Dear ryanb31 i have already told that update 2 table together not one by join.
ZurdoDev 21-Mar-12 8:47am    
Sorry, your question in English was not clear. I am not sure if SQL allows that. Can you not do it in a 2 statements?
Mas11 28-Mar-12 8:36am    
Yes i can make it easy...
Can we update 2 table by inner join

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