?
Solved

Ranking in Access

Posted on 2012-03-12
8
Medium Priority
?
322 Views
Last Modified: 2012-03-23
I have an access table that has points calulated.

vendor 1
Rating 1  60 pts
Rating 2  40 pts
Rating 3  40 pts
Rating 4  30 pts
Rating 5  20 pts

I have created a query that ranks the ratings.  It comes out so:
1
2
2
4
5

What I need it to do is a distinct rating like so:
1
2
2
3
4
0
Comment
Question by:dbasetrouble
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 15

Accepted Solution

by:
Ess Kay earned 1500 total points
ID: 37711831
that makes no sense. can you please provide a screenshot
0
 

Expert Comment

by:gnetgnet
ID: 37711833
Do a
Select Distinct Ranking
0
 

Author Comment

by:dbasetrouble
ID: 37715933
Snapshot of Table.Here is a screen snap shot of the Database table.  I need ranking according to the points column.  There is a tie.  I need the rank to look like this:
1
2
2
3
4
Not
1
2
2
4
5
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Expert Comment

by:gnetgnet
ID: 37716005
I see your problem, I don't have an answer for that off the top of my head. Sorry!
0
 
LVL 15

Expert Comment

by:Ess Kay
ID: 37716120
1        one solution is to order it by rating, then take the row number


2          another is to use WITH TIES

source: http://harriyott.com/2007/06/with-ties-sql-server-tip.aspx

SELECT TOP 5 WITH TIES Name, Score
FROM Scores
ORDER BY Score DESC

Open in new window


Which gives:

Name      Score
Brenda      42
Maureen      41
Edwin      41
Terry      40
Rupert      39
Arthur      39
Paula      39




If you choose to use the second method. You can query into it from another query and select the rankings that way
0
 
LVL 15

Expert Comment

by:Ess Kay
ID: 37716369
Actually this will probably work better



SELECT * FROM
 (SELECT id, points from member1 )Y INNER JOIN
(SELECT DISTINCT points, count(*)as rating FROM member1 GROUP BY points ORDER BY points )X ON Y.points = X.points
ORDER BY Points
0
 

Author Comment

by:dbasetrouble
ID: 37716537
Thanks for the help.  Figured out a much easier way.  I created a query call distinctrank.  I added just the points field and change the query properties to uniquevalue=Yes.  I then create a expression field in the regular query that looks like this:

Rank1: DCount("*","distinctrank","Points >" & [Points])+1

Work out great.
0
 
LVL 15

Expert Comment

by:Ess Kay
ID: 37716583
great to hear, if you have a large table the last one i added might work quicker, but it looks like you might not need it
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question