How can I create a rank field in a query according to a specific .

G

Guest

I want to crate several ranking fields in a query. Ex. Field1 rank by age
(1,2,3), field 2 rank by weight etc. Example row:

Name Age rank Age Weight RAnk Weight
Joe 1 25 2 180
John 2 22 1 190

Thanks
 
M

Marshall Barton

Kunter said:
I want to crate several ranking fields in a query. Ex. Field1 rank by age
(1,2,3), field 2 rank by weight etc. Example row:

Name Age rank Age Weight RAnk Weight
Joe 1 25 2 180
John 2 22 1 190


Each ranking field can be calculated using a subquery like:

AgeRank: (SELECT Count(*) FROM theTable AS X WHERE X.Age <=
thetable.Age)

WeightRank: (SELECT Count(*) FROM theTable AS X WHERE
X.Weight<= thetable.Weight)
 

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