TOP VALUES HELP

  • Thread starter Thread starter JUAN
  • Start date Start date
J

JUAN

Hello,
is there a way to get top values for each group. Example,
I have:
Prod group PartNumber Count
XYZ 123X 20
xyz 1562x 5
BZZ 2352X 35
BZZ 26542 20

Lets say each product group has 100 entries, what I want
is to get top 5 parts for each product group. When I used
the Top Value to show 5, this shows 5 entries, but not
within each product group. Is there a way to do this, I
dont' want to manually delete.
Any help would be appreciated.
Thanks
Juan
 
You might try a query whose SQL looks something like this:

SELECT
[Your Table].*,
FROM
[Your Table]
WHERE
[Your Table].[PartNumber]
IN
(SELECT TOP 5
[Self].[PartNumber]
FROM
[Your Table] AS [Self]
WHERE
[Self].[Prod group] = [Your Table].[Prod group]
ORDER BY
[Self].[Count] DESC)
 
Back
Top