Employee table have EmployeeID, and his salary for each month
EmpID
|
EmpName
|
Salary
|
month
|
1
|
Sally
|
2000
|
2
|
1
|
Sally
|
2500
|
3
|
2
|
Noor
|
3200
|
1
|
2
|
Noor
|
3250
|
2
|
to get difference between salary for EmpID = 1 for month 2 , 3
SELECT empName as name , salary - (
SELECT salary
FROM Employee
WHERE month = 2
) as Diff_Salary
from Employee
where month = 3
and EmpID = 1
the Result
Andar Bahar card game
ReplyDelete