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

Update Column in table from another table based on criteria

Status
Not open for further replies.

jallen919

Technical User
Mar 30, 2001
30
US
I have one table with columns for lastname, homephone and e-mail and another table with just lastname and homephone. I've added the e-mail column to the second table and want to update it with e-mail addresses based on the criteria where lastname=lastname and hmphone=hmphone. I've tried both an update and append query and neither work. The current update SQL code I have is:

UPDATE tblLeads INNER JOIN TABLE1a ON tblLeads.HmPhone = TABLE1a.HmPhone SET tblLeads.EMail=[table1a].
WHERE ((("LastName")="LastName") AND (("HmPhone")="HmPhone"));

It says the right number of rows will be updated but the information doesn't get updated.

 

Try this query.

UPDATE tblLeads INNER JOIN TABLE1a
ON tblLeads.HmPhone = TABLE1a.HmPhone
AND tblLeads.LastName = TABLE1a.LastName
SET tblLeads.EMail=table1a.email;


Terry
------------------------------------
Blessed is the man who, having nothing to say, abstains from giving us worthy evidence of the fact. -George Eliot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top