I have two tables;
Technology Look Up table
OSID OSValue
1 UNIX
2 ORACLE
3 .NET
4 SQL
5 SAP
------------------
Employee technology
empID OSID
34 1
37 2
45 2
34 4
45 6
Employee ID NO 37 is no more using ORACLE . He shifted to SAP . That is OSID should b updated from 2 to 5 in the second table .
I have a temp table that has vales for technology and employee id
Please help me with
– writing a query that joins both above tables
– Look up the ID of the SAP technology , and update the second table with that ID .
Update emp
Set emp.OSID = (Select OSID from technologylookup where OSValue = tmptbl.technologyname)
FROM employee_tech emp INNER JOIN #Temptbl tmptbl ON emp.emp_id = tmptbl.emp_id
Join your lookup table to the temp table, and then update the employee_tech table with the ID from that table