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

Find matching values

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
CA
I have a spreadsheet that I have to import. It only includes last names. I have a table that includes last names and employee ids.
So what I have to do after I import the data, I need to run a query to find and assign all matching Employee IDs to the last names from the spreadsheet.

Please suggest the sql.

Thanks.
 
Here is the syntax for an update-type SQL statement that will update a table with the values. I have used my table names, but I think you might get the idea on how to substitute your tables for mine.

My sample below uses two tables (tblManagers and tblUsers). I have asked that for all values in my tblManagers table that have the field "Name" that equals the tblUsers field "UserName", to update the tblManagers table with the value from the similar field in my tblUsers table.

UPDATE tblUsers RIGHT JOIN tblManagers ON tblUsers.UserName = tblManagers.Name SET tblManagers.BusinessArea_ID = [tblUsers].[BusinessArea_ID];

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top