an unusual query?

N

Nicholas Steinhoff

This is one I've come across that seems like it should be simple, but it
apparently isn't, as far as I can tell.

Suppose we have our typical "employees" database, with things like name,
department, and salary. (My application is altogether different, but
"employees" is a common enough one to use to describe an analogous case.)

I want to write a query that will show me the five highest-salaried
employees in each department. (My application contains many "departments",
so it's not practical to write a "top 5" query for each department and then
form a union of the results.

Thanks for any clever solutions to this one. (And my apologies if this is a
no-brainer and I missed something obvious - my Access skills have gotten a
bit rusty.)

Nicholas
 
N

Nicholas Steinhoff

Allen Browne said:
A very simply way to output this is a report with a grouping level on
EmployeeID, and a subreport bound to a TOP 5 query.

If that is not suitable, see:
ACC2000: How to Create a "Top N Values Per Group" Query
at:
http://support.microsoft.com/?id=210039

Thank you greatly - the Microsoft tip for creating a subquery made it quite
simple - subqueries and subreports are something I've never managed to
really learn well - this will help in my general education as well.

Nicholas
 

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


Top