Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rank Ordering

Status
Not open for further replies.

charlie123

Technical User
Jan 31, 2004
1
IN
How do you Rank (ie: 1-10 based on sales volume high to low). I tried: RANK ([Sales Volume], 10, 0) but Access kept saying could not recognize RANK command. Suggestions?
 
Hi!

Try this:

Select Top 10 [Sales Volume] From YourTable Order By [Sales Volume] Desc

hth Jeff Bridgham
bridgham@purdue.edu
 

Simple case:

Select Top 10 ID, [Sales Volume]
From table
Order By [Sales Volume] Desc

Add a column to show rank:

Select Top 10 ID, [Sales Volume],
(Select Count(*) From table
Where [Sales Volume]>=[t].[Sales Volume]) As Rank
From table As t
Order By [Sales Volume] Desc
Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top