Advertisement
Guest User

update subquery not working

a guest
Jun 28th, 2015
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.57 KB | None | 0 0
  1. UPDATE Employees
  2.     SET
  3.     JobTitle = 'Senior ' + JobTitle,
  4.     Salary = 1.5 * Salary,
  5.     HireDate = GETDATE(),
  6.     --this does not work, why?
  7.     ManagerID = (SELECT M.EmployeeID FROM Employees M WHERE M.LastName = 'Tamburello')
  8. FROM Employees E
  9. INNER JOIN Departments D
  10. ON D.DepartmentID = E.DepartmentID
  11. WHERE D.Name = 'Engineering'
  12.  
  13. UPDATE Employees
  14.     SET
  15.     JobTitle = 'Senior ' + JobTitle,
  16.     Salary = 1.5 * Salary,
  17.     HireDate = GETDATE(),
  18.     --this works:
  19.     ManagerID = 3
  20. FROM Employees E
  21. INNER JOIN Departments D
  22. ON D.DepartmentID = E.DepartmentID
  23. WHERE D.Name = 'Engineering'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement