I'm trying to do a query for the top 3 values per group, but i want to include duplicates. I'm not very experienced with SQL...but this is what i found that pulls up the top 3.
SELECT Results.ContactID, Results.Class, Numbers.Total
FROM Results INNER JOIN Numbers ON Results.ContactID=Numbers.ContactID
WHERE (((Numbers.Total) In (Select Top 3 [Total] From Numbers Where [Class]=[Results].[Class] Order by [Total] Desc)))
ORDER BY Results.Class, Numbers.Total;
If the totals in class 1 are
100
100
99
98
I need it to pull all four, since there is a duplicate.
Any help would be appreciated.
lk96
SELECT Results.ContactID, Results.Class, Numbers.Total
FROM Results INNER JOIN Numbers ON Results.ContactID=Numbers.ContactID
WHERE (((Numbers.Total) In (Select Top 3 [Total] From Numbers Where [Class]=[Results].[Class] Order by [Total] Desc)))
ORDER BY Results.Class, Numbers.Total;
If the totals in class 1 are
100
100
99
98
I need it to pull all four, since there is a duplicate.
Any help would be appreciated.
lk96