Click here to Skip to main content
15,867,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 11:01am

1 solution

Try:
SQL
SELECT TOP 1 COMM, ENAME FROM Emp ORDER BY COMM DESC
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900