hellow guys i have some data in tables like this
Data in our table:
EmpName Salary
Row 1. EmpName1, 10000
Row 2. EmpName2, 20000
Row 3. EmpName3, 12000
i want to get highest salary and minus 2nd highest and show diifrence like this
Empname Salary Diifrence
Row 1. EmpName2, 20000, 8000
Row 2. EmpName3, 12000, 2000
Row 3. EmpName1, 10000, NULL
how can i get this in sql server please some one to help me
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Jignesh KumarRank #91 · 22.9K reputationPosted Apr 10, 2020, 5:11 AM EDT