Need to rank and break tie using query

emsadoon

Registered User.
Local time
Today, 12:30
Joined
Jun 6, 2013
Messages
83
I have a score column for my data in a query. I want to add a rank column beside it to rank according to the scores.I also need a way to break the ties using 3 other criteria, which are all dates. I appreciate it if you can guide.
 
Just to clarify, my current query has the following columns, (project-ID, project priority#1, project priority#2, Score). The Score column is simply the addition of priority#1 and priority#2.
 
Thanks jdraw. I read and practiced the instruction in the link. Just a couple of things:
1)this instruction does not break the ties, It just ranks according to the values
2)How can I break the ties according to second and third criteria?
 
In Allen's article he says
Ranking in a query

To handle tied results correctly, count the number of records that beat the current row.

The example below works with the Northwind sample database. The first query calculates the total value of each customer's orders (ignoring the Discount field.) The second query uses that to calculate how many customers had a higher total value:
 
Sorry, I may not understand correctly. I created both the above queries in the Northwind database not for the same tables mentioned in the above example, but for Product Table (Product Id and Units In Stock) as an example. When I run the query I get same ranks for the product Ids that have same units in stock.
 
I haven't tried the queries, but just thinking about your post.
If you have equal numbers of units in stock, and stock count is what determines rank, then I can see them being equal or tied. Do you have some other "attribute" that could be used to break the tie.

Example:
Golf tournament

Tiger scores -1 (1 under par)
Bill, Fred and Tom shoot par (E)
Phil shoots +1 (1 over)

Rankings based on scores is
1st Tiger -1
2nd (Bill, Fred and Tom) (E) (tied for 2nd)
3rd Phil +1

How do you break the tie? Closest to the Pin, most Birdies????
 

Users who are viewing this thread

Back
Top Bottom