If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > multi-table update?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-04-04, 12:40
cb1 cb1 is offline
Registered User
 
Join Date: May 2004
Posts: 4
multi-table update?

i need to update the destination table, dt, with values from the source table, st, and join the two on the pk. i get a syntax error with the following :

update dt set c1 = st.c1 from t1 as st, t2 as dt
where dt.pk_id = st.pk_id and dt.last_modified <> st.last_modified

that's sql server syntax that works, i just need help finding the equivalent mysql syntax.
Reply With Quote
  #2 (permalink)  
Old 05-04-04, 12:47
cb1 cb1 is offline
Registered User
 
Join Date: May 2004
Posts: 4
nevermind, i figured it out after finding a mysql reference manual.

update t1 as st, t2 as dt set dt.c1 = st.c1
where dt.pk_id = st.pk_id and dt.last_modified <> st.last_modified
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On