SQL Query Question

AcceSs-AbLe

Board Regular
Joined
Jan 27, 2003
Messages
87
Hi,

I am trying to come up with a query that is able to Rank the results in Descending order. I was successful in coming up with this but the problem I have is that when two fields are equal, it ranks the result as 1,2,2,4 instead of 1,2,3,4. I need to insert a Tie-Breaker statement, how would I accomplish this? This is my current SQL Statement:

HEVolRank: (Select Count(*) from [Division Snapshot XXX] Where [HEVolVar] >[Snapshot].[HEVolVar])+1

[Snapshot]=Alias of [Division Snapshot XXX]

The tie breaker would be the HEVol field.

Is there a way to add an iif in SQL statement?

TIA
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Could you create a new calculated field which combines both fields use in determining the ranking, and then do the ranking off of this calculated field?
 
Upvote 0
Thanks for your reply. I am restricted from creating a new calculated field based on combination of the two fields due to sensitivity of the calculation. What would be an another approach?
 
Upvote 0

Forum statistics

Threads
1,221,623
Messages
6,160,889
Members
451,676
Latest member
Assy Bissy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top