Top 10 within a few groups (1 Viewer)

Alc

Registered User
Joined
Mar 23, 2007
Messages
2,325
I have a query that returns the following values:

Group_Name
Group_Priority
Person_Name
Amt_From
Amt_To
Branch
ID_Number

How can I select from this to get the top 10 'Amt_From' values within each Group_Name, in one query?

I can get the top 10 overall, and I can find the top 10 by specifiying a Group_Name value, but I'm hoping to find all in one query.

Any ideas gratefully received.
 

Alc

Registered User
Joined
Mar 23, 2007
Messages
2,325
Thanks for the response.

I can live with using two - could you point me in the right direction? I'm thinking a union of some sort, but not getting much further.
 

Alc

Registered User
Joined
Mar 23, 2007
Messages
2,325
Got it!

I had to Union query the results of six separate queries, but it worked.

In case it's of any use to anyone else, the result looks like this:

Code:
(SELECT 
   Top 10 Amt_From,
   Amt_To,
   Group_Name, 
   Group_Priority, 
   Person_Name, 
   Branch, 
   ID_Number
FROM 
   [Qry_Conf_Lead_Board]
WHERE
   Group_Name = 'ATLANTIC')
UNION
(SELECT 
   Top 10 Amt_From,
   Amt_To,
   Group_Name, 
   Group_Priority, 
   Person_Name, 
   Branch, 
   ID_Number
FROM 
   [Qry_Conf_Lead_Board]
WHERE
   Group_Name = 'QUEBEC')
UNION
etc.
etc.
Thanks for the pointer, MStef. Made all the difference. :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom