Reputation: 1
I'm trying to alter the employees pay using data from a separate table to determine if the employee has a specific job classification.
It's telling me I have an invalid column name. But the column exists.
Any help is appreciated, while I continue to look for a solution.
Thanks guys.
USE HARTKudlerFineFoods
SELECT dbo.tblEmployee.empSalary,
dbo.tblJobTitle.jobJobClassification
FROM dbo.tblEmployee
FULL OUTER JOIN dbo.tblJobTitle
ON dbo.tblEmployee.empJobID = dbo.tblJobTitle.jobJobID
BEGIN TRANSACTION;
UPDATE dbo.tblEmployee
SET empSalary = empSalary * .05946
WHERE ( [jobJobClassification] = '%ist' );
Upvotes: 0
Views: 61
Reputation: 1271003
I am guessing you really want:
UPDATE e
SET empSalary = empSalary * (1 + 0.05946)
FROM dbo.tblEmployee e JOIN
dbo.tblJobTitle jt
ON e.empJobID = jt.jobJobID
WHERE jt.jobJobClassification like '%ist';
This will give all the people whose job title ends in ist
a raise of 5.946%.
Upvotes: 3