
April 1st, 2004, 04:38 PM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 14
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I need help structuring an UPDATE statement with multiple joins
Okay I have an application where I need to replace a variable in one data table with the value from another data table. Problem is there are two table in between that relates the records and I can’t figure out how to structure the update statement.
I use a join like the one below to return a record set.
SELECT Table_1.Var_1, Table_1.Var_2, Table_2.Var_3, Table_2.Var_4, Table_2.Var_5, Table_3.Var_6, Table_3.Var_7, Table_3.Var_8, Table_4.Var_9, Table_4.Var_10 FROM Table_1, Table_2, Table_3, Table_4 WHERE Table_1.Var_2 = Table_2.Var_3 AND Table_2.Var_4 = Table_3.Var_6 AND Table_2.Var_5 = Table_3.Var_7 AND Table_3.Var_8 = Table_4.Var_9
I need to then replace Var_1 in Table_1 with Var_10 from Table_4 for all of the records returned by the SELECT statement. The SELECT statement works perfectly. I’ve worked on the update for a while and sadly have made no significant headway. Any suggestions and help will be greatly appreciated.
Thank you!
iRead
|