Aggregate rank query question

M

Mikael Lindqvist

Hi everyone,

I found an older thread that partly answered my question:

http://www.microsoft.com/office/com...ffice-access&lang=en&cr=US&sloc=en-us&m=1&p=1

Which describes how to create a query that ranks different fields.

Now, I have a table with various records for same field and I need to sum
the records (Profits) and then return the (companys) with biggest aggregate
Profit.

I believe I need to change this query:

(SELECT Count(*) FROM tblCompanyProfits AS VT
WHERE VT.Region = tblCompanyProfits.Region AND
VT.Profits > tblCompanyProfits.Profits)+1

To an aggregate query, but what should it look like?

If I get above right I guess the rank-part does work as given?

GroupRank: (SELECT Count(*) FROM tblCompanyProfits AS VT WHERE
VT.Region = tblCompanyProfits.Region AND VT.Profits >
tblCompanyProfits.Profits)+1

Good weekend to everyone!

Cheers,
Mikael
 

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