Reputation: 13
I have two tables Employees
EmpID | EmpName | EmpDob
and WareHouseEmployeers
WarehouseEmpID | position | province
I need to update the Employee
table according to the WareHouseEmployers
table's values. How do I update the details about the employee table according to warehouse province and position?
I have tried this but it's not working:
UPDATE Employee
SET a.EmpName = 'Steven', a.EmpDob = '5-5-1990'
FROM Employee a, WareHouseEmployee b,
WHERE
a.EmpID = b.WareHouseEmpID
AND position = 'manager', province = 'central'
Can someone please help me to do that in SQL Server?
Upvotes: 1
Views: 70
Reputation: 364
Please use this script
UPDATE a
SET a.EmpName = 'Steven' , a.EmpDob='5-5-1990'
FROM Employee a
INNER JOIN WareHouseEmployee b ON a.EmpID = b.WareHouseEmpID
AND position = 'manager'
AND province = 'central'
Upvotes: 1