Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update query

Status
Not open for further replies.

Recordsetclown

Technical User
Jul 12, 2002
64
0
0
US
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?





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top