I came up with the following query, which is not so difficult to solve, but still I think there might be a better approach for this. Any sentences? Thanks in advance.
I have the following table
tb_Salary
Salary EmpID DeptID
---------------------
1 1 20000
2 1 20000
3 2 30000
4 2 800
5 & nbsp; 2,200
I want to increase the salary of rupees employees. 1000, only when the average salary in the department is more than 35000.
Is this possible using a single update request?
I did it as follows. But it seems that this is not a reasonable decision.
tb_Salary t1
SET t1.Salary = t1.Salary + 1000
35000 < ( AVG (t2.Salary) tb_Salary t2 WHERE t2.DeptID = t1.DeptID)