Posted by calan on 10/01/77 11:27
How can I update each record in a table, based on a value in another table
with a single SQL statement?
For example, suppose I have the following two tables:
Table1
Name Something Color
-----------------------------------------
John GHAS Blue
John DDSS Blue
John EESS Blue
Paul xxxx Red
Ringo HJKS Red
Ringo FFFS Red
Sara hjkd Purple
Sara TTHE Purple
Jimi sdkjls Green
Table2
Name Color
------------------------
John ?
Paul ?
Ringo ?
Sara ?
Jimi ?
How can I update the color field in table 2 to correspond with the color
field in table1 (so I can normalize the db and delete the color field from
table1)?
I know I could open table2 and loop through within my app; just wondering
about a single SQL statement that would do it. I need a similar technique in
other places as part of my app.
Thanks,
Calan
Navigation:
[Reply to this message]
|