top 2 records per group

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to write a query that will sort records by group and show only
the most recent two entries by date.

IE my table has lots of football teams and shows all their results. I would
like to be aable to show all the teams and their most recent two results only.
 
Here's an example of a query to do something similar, offered by Duane:

SELECT *
FROM tblSales
WHERE ProductID IN (SELECT Top 5 ProductID FROM tblSales S WHERE
S.DistrictID = tblSales.DistrictID ORDER BY Profit DESC)
--
Duane Hookom


--
Good luck

Jeff Boyce
<Access MVP>
jademaddy said:
Is it possible to write a query that will sort records by group and show only
the most recent two entries by date.

IE my table has lots of football teams and shows all their results. I would
like to be aable to show all the teams and their most recent two results
only.
 

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

Similar Threads

Total appointments per agent 2
grouping error? 8
Top Two Items per customer 18
Query to select individual records 4
query grouping issue 6
TOP N Records with 2 tables 1
query to get top player 8
Top 2 per Group 2

Back
Top