TOP values

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

Guest

Hi,

I am having trouble returning the top values in a GROUP BY or TOTALS query.
I would like to GROUP BY an attribute (Accounts) and return the top 5 values
(Deposits) per account holder.

I am having trouble because the GROUB BY MAX function only returns one value
(the max value) PER ACCOUNT and I need it to return the highest 5 values.

Your help is appreciated. Thanks in advance.
Dina
 
Hi Allen,

Many thanks for the link. In the link you provided me, OrderID is unique.
Do I HAVE to have a unique attribute for this to work??

Thank you,
Dina
 
It doesn't have to be a single field, but there does have to be some way to
determine which fields constitute the related records if you are to choose
the top 5 for each one.
 
Ok, thanks Allen. I managed to use your advice & it worked.

As a follow up/related question:

Instead of selecting the Top 5 records per account holder in the subquery,
is there a way to select every 2nd (or 3rd etc) record per account holder?

Thanks again.
 

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

Greatest date per Unit 3
Sum and Join 1
ONE record per client 2
Top 5 by a GROUPing? 1
Multiple Top Values 2
top n with duplicates 0
Select Top with aggregate function 1
Grouping query 5

Back
Top