SyntaxFix
Write A Post
Hire A Developer
Questions
;with cte as ( Select Department, Max(salary) as MaxSalary from test group by department ) select t.* from test t join cte c on c.department=t.department where t.salary=c.MaxSalary;
try this