MySQL Forums
Forum List  »  Newbie

Update query
Posted by: jesse kaye
Date: March 15, 2010 05:17PM

I am stumped as to how to make this work. I have the following elements:

UPDATE default_en_listingsdb as r1

INNER
JOIN default_en_listingsdbelements as r2
ON r2.listingsdb_id = r1.listingsdb_id
AND r2.listingsdbelements_field_name = 'MLSID'
AND r2.listingsdbelements_field_value = 'M223'

r1 and r2 are related on listingsdb_id, but the value I need to put into r1 comes from a table with no direct relationship to these. I need to match names that are also stored in r2, with user names in default_en_userdb, call it r3, to find the userid to put into r1.

r2.listingsdbelements_field_name = 'agentfirstname'
AND r2.listingsdbelements_field_value = r3.userdb_user_first_name
AND r2.listingsdbelements_field_name = 'listingagentlastname'
AND r2.listingsdbelements_field_value = r3.userdb_user_last_name
SET r1.userdb_id = r3.userdb_id

Can anyone tell me how to put this together?


--------------------------------------
West End DC Homes For Sale



Edited 1 time(s). Last edit at 03/22/2010 02:36PM by jesse kaye.

Options: ReplyQuote


Subject
Written By
Posted
Update query
March 15, 2010 05:17PM
March 15, 2010 09:52PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.