I want to find top 2 earners in each department
table => staff_masters having "staff_name" column for staffs and "dept_code" for corresponding department.
I tried to like this
SELECT TOP 2 staff_sal
FROM staff_masters
GROUP BY dept_code;
Please use group by clause.