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.
 
Back
Top