SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 1st, 2004, 05:49 PM
iRead iRead is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 11 iRead User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > I need help structuring an UPDATE statement with multiple joins


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT