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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update within 2 tables using LIKE

Status
Not open for further replies.

cumap

IS-IT--Management
Jul 9, 2007
268
US
Hello,
I'm trying to update a table with this query but doesn't seem to work at all
Code:
update tblCustomerThreads
SET UserID = tblContacts.idSalePerson, idCustomer = tblContacts.idCustomer
from tblCustomerThreads, tblContacts
WHERE tblCustomerThreads.idGoldMine LIKE %tblContacts.idGoldMine%

The query seems to run for a second and done, but I found no record has been changed. My guess is that it didn't find any match. Please help.
 
Please help me verify the query as you mentioned because I, now, cannot test it because Godaddy server is down somehow.

Code:
update tblCustomerThreads
SET UserID = tblContacts.idSalePerson, 
idCustomer = tblContacts.idCustomer
FROM tblCustomerThreads
LEFT JOIN tblContacts
ON tblCustomerThreads.idGoldMine LIKE %tblContacts.idGoldMine%

thanks!
 
verify it once the server is back up by doing a select instead of an update. Verify what is returned and then run the Update if all looks right.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top