Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 What would the SQL be for this?

Author  Topic 

spmchugh82
Starting Member

13 Posts

Posted - 2009-03-20 : 14:06:09
I have an invoice table:

INVOICE
-------
ID
InvoiceNumber
Salesperson
Product
Quantity

How would I return the how many items each person has sold and have it ordered by the top seller first?

Thank you so much!

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-03-20 : 14:11:31
select Salesperson, count(*) invoices from Invoice group by Salesperson order by count(*) desc, Salesperson
Go to Top of Page

spmchugh82
Starting Member

13 Posts

Posted - 2009-03-20 : 17:21:18
This worked, thank you!
Go to Top of Page
   

- Advertisement -