Click here to Skip to main content
14,360,161 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have a table with many values, but I wanna focus on COMM (Commision) and ENAME (Employee Name) the overall section is emp. I wanna get the max commission and get the name of the employee who has it.

What I have tried:

SELECT COMM,ENAME FROM emp;
just outputs all the names and commissions of employees but I want just the max one. So I tried
SELECT MAX(COMM),ENAME FROM emp;
but that just says I cant do a single group group function.
Posted
Updated 8-Nov-19 12:01pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Try:
SELECT TOP 1 COMM, ENAME FROM Emp ORDER BY COMM DESC
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100