Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how to update all records of one table by taking value from another table ?


I have stored some wrong data in table 1
( FK Table1.Column B - Table2.Column A )

Table 1
Column A Column B Column B
1 3 222(Expected 555)
2 4 223(Expected 666)
3 5 224(Expected 777)


Table 2
Column A Column B
3 555
4 666
5 777


and My Requirement is

Table 1
Column A Column B Column B
1 3 555
2 4 666
3 5 777

How should I write the Sql Update Query ?
Posted
Updated 22-Jan-11 20:54pm
v2
Comments
Estys 23-Jan-11 8:02am    
If it's THE answer, mark it as "Answered" please. I moved your answer to a comment.
Manfred Rudolf Bihy 23-Jan-11 8:53am    
If your problem was solved by Esty's answer please mark the answer as accepted. Thanks!

1 solution

See example #2 in the following link :
http://techonthenet.com/sql/update.php[^]

Cheers
 
Share this answer
 
Comments
Estys 23-Jan-11 8:03am    
Thanx...
It Works....
I got what exactly I want...
Manfred Rudolf Bihy 23-Jan-11 8:52am    
Proposed as answer! 5+

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