Click to See Complete Forum and Search --> : Query in SQL (hit dead end)


rotarfreak
March 17th, 2003, 09:09 PM
hi, i think i am in a correct forum..

here is the table in question(salesperson):

Name PercentOfQuota Salary
-----------------------------------
Abel 63 120000
Baker 38 42000
Jones 26 36000
Kobad 27 36000
Murphy 42 50000
Zenith 59 118000

How do i write a query to display the name of the person with highest percent of quota? :confused:

I tried all kinds of things but i get agregate function errors.

i was thinking something along the lines of this:

select name
from salesperson
where percentofquota = max(percentofquota)


Thanx
Alex-

aio
March 18th, 2003, 12:25 AM
The MS Access way:

select name
from salesperson
order by percentofquota desc;

kimmckenzie
March 18th, 2003, 08:50 PM
Select Name from salesperson where percentofquota = (select Max(percentofquota) from salesperson)

mongoose0211
April 6th, 2003, 07:58 PM
Another method for SQL Server 2000:

SELECT TOP 1 NAME
FROM SALESPERSON
ORDER BY PERCENTOFQUOTA DESC