TOP VALUES HELP

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
 
B

Brian Camire

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)
 

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

Top