Ranking Mtk Volume

M

mccallen60

Hello,
I’m trying to create a query that ranks my market volume from highest to
lowest. The rank needs to be in a separate field. Here’s what I have:
<MKT VOL>
187
3
684
52
205

Here’s what I need:
<MKT VOL> <RANK>
684 1
205 2
187 3
52 4
3 5

Any help is greatly appreciated. Thanks.
 
M

mccallen60

Allen Browne said:
See:
Ranking and numbering records
at:
http://allenbrowne.com/ranking.html

Choose the approach that suits you best.
Hi Allen,
Thanks for your timely reply. However, I am very confused by your answer to
my issue. I reviewed your link. According to the Rankin in a Query example,
it looks as if it first calculates the value in the first query, then ranks
them in the second query. I figured I needed to utilize the second query as I
already have the Mkt Vol value. Here's my query:
Rank: (SELECT Count( [08 Top 200 Prescribers - Mkt Volume]![Market Vol
(Apr08-Jun08)] ) AS HowMany
FROM «Expr» [08 Top 200 Prescribers - Mkt Volume]![Market Vol
(Apr08-Jun08)] AS Dupe
WHERE Dupe.TotalValue > [08 Top 200 Prescribers - Mkt Volume]![Market Vol
(Apr08-Jun08)] )

What am I doing wrong? Sorry, I'm an Access novice. Thanks.
 
A

Allen Browne

I'm not sure I understand your subquery.

The SELECT clause need to select someting from Dupe (i.e. something in this
subquery), not from the table in the main query.

I have not idea what <<Expr>> is doing in your FROM clause.

I'm also unclear why you have what seems to be a field name in the FROM
clause.

I don't know if you need Sum() in the WHERE clause.

Sorry: can't make sense of it.

Obviously we can't write your query for you, and we can't see your tables
either.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

mccallen60 said:
Allen Browne said:
See:
Ranking and numbering records
at:
http://allenbrowne.com/ranking.html

Choose the approach that suits you best.
Hi Allen,
Thanks for your timely reply. However, I am very confused by your answer
to
my issue. I reviewed your link. According to the Rankin in a Query
example,
it looks as if it first calculates the value in the first query, then
ranks
them in the second query. I figured I needed to utilize the second query
as I
already have the Mkt Vol value. Here's my query:
Rank: (SELECT Count( [08 Top 200 Prescribers - Mkt Volume]![Market Vol
(Apr08-Jun08)] ) AS HowMany
FROM «Expr» [08 Top 200 Prescribers - Mkt Volume]![Market Vol
(Apr08-Jun08)] AS Dupe
WHERE Dupe.TotalValue > [08 Top 200 Prescribers - Mkt Volume]![Market Vol
(Apr08-Jun08)] )

What am I doing wrong? Sorry, I'm an Access novice. Thanks.
 
M

mccallen60

Sorry I bothered you.

Allen Browne said:
I'm not sure I understand your subquery.

The SELECT clause need to select someting from Dupe (i.e. something in this
subquery), not from the table in the main query.

I have not idea what <<Expr>> is doing in your FROM clause.

I'm also unclear why you have what seems to be a field name in the FROM
clause.

I don't know if you need Sum() in the WHERE clause.

Sorry: can't make sense of it.

Obviously we can't write your query for you, and we can't see your tables
either.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

mccallen60 said:
Allen Browne said:
See:
Ranking and numbering records
at:
http://allenbrowne.com/ranking.html

Choose the approach that suits you best.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Hello,
I’m trying to create a query that ranks my market volume from highest
to
lowest. The rank needs to be in a separate field. Here’s what I have:
<MKT VOL>
187
3
684
52
205

Here’s what I need:
<MKT VOL> <RANK>
684 1
205 2
187 3
52 4
3 5

Any help is greatly appreciated. Thanks.
Hi Allen,
Thanks for your timely reply. However, I am very confused by your answer
to
my issue. I reviewed your link. According to the Rankin in a Query
example,
it looks as if it first calculates the value in the first query, then
ranks
them in the second query. I figured I needed to utilize the second query
as I
already have the Mkt Vol value. Here's my query:
Rank: (SELECT Count( [08 Top 200 Prescribers - Mkt Volume]![Market Vol
(Apr08-Jun08)] ) AS HowMany
FROM «Expr» [08 Top 200 Prescribers - Mkt Volume]![Market Vol
(Apr08-Jun08)] AS Dupe
WHERE Dupe.TotalValue > [08 Top 200 Prescribers - Mkt Volume]![Market Vol
(Apr08-Jun08)] )

What am I doing wrong? Sorry, I'm an Access novice. Thanks.
 

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