Answer: It doesn’t have a GROUP BY clause. The Name should be in the GROUP BY clause. The correct query is
SELECT Name, MaxSal = Max(Salary)
FROM tblEmployees
Group By Name
- OR -
Select Name, MaxSal = MAX(Salary) OVER (PARTITION BY Name)
FROM tblEmployees
Asked In: Many Interviews |
Alert Moderator