Top 3 items per customer

  • Thread starter Thread starter Natalie
  • Start date Start date
N

Natalie

Hi all,

Apologies for what is probably a trivial question but I am
a newbie.

I have a table (CUSTORDERS) which contains the fields
Customer, Date, Item, Cost

I am trying to list the latest 3 transactions for each
customer.

I have the following:
SELECT TOP 3 Date, Customer, Item, Cost
FROM CUSTORDERS
ORDER BY Customer ASC, Date DESC

This of course gives me the latest 3 transactions overall,
not per customer.

Can anybody give me a hand as to how I can work this out
per customer.

Thanks in advance,

Natalie
 
Back
Top