count top a few records

S

sg

Hi,

I'm trying to create a query to only show top 10 sales account information
sorted by sales descendingly.
account, name, sales.
How can I do this? I tried having count("account")=10 , it doesn't work.

Thanks in advance,
Sarah
 
S

sg

Sorry, I posted this in the wrong group. I actually got the answer in query
group.

Sarah
 
M

Marshall Barton

sg said:
I'm trying to create a query to only show top 10 sales account information
sorted by sales descendingly.
account, name, sales.
How can I do this? I tried having count("account")=10 , it doesn't work.


You can use the TOP predicate to do this (except that it
will include ties).

SELECT TOP 10 account, name, sales
FROM the table
ORDER BY sales DESC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top