I used a subquery to return the rank. The subquery uses a copy of the same table and simply counts the number of records in the copy where the score <= the score in the original table.
You could also use DCount() but that would be much less efficient:
To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Thu, 14 Apr 2016 23:12:03 +0100
Subject: Re: [MS_AccessPros] RANKING
You could also use DCount() but that would be much less efficient:
SELECT tblAde.StudentName, tblAde.Score, DCount("*", "tblAde", "Score <=" & Score ) AS Rank
FROM tblAde;
Duane
To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Thu, 14 Apr 2016 23:12:03 +0100
Subject: Re: [MS_AccessPros] RANKING
Duane,
I am very interested in your solution as it may be helpful to me also, but I don't understand it.
How does the "FROM tblAde A WHERE A.Score <= tblAde.Score" part work?
Dave W
----- Original Message -----
Sent: Wednesday, April 13, 2016 6:45 PMSubject: RE: [MS_AccessPros] RANKINGAde,The typical method using SQL like:SELECT tblAde.StudentName, tblAde.Score, (SELECT COUNT(*) FROM tblAde A WHERE A.Score <=tblAde.Score ) AS RankFROM tblAde;This doesn't account for your using ".5" for ties. Before working on any type of solution for this, we would need to know what this would like like if there is a 3-way tie or even more.Duane Hookom, MVP
MS Access
__._,_.___
Posted by: Duane Hookom <duanehookom@hotmail.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (10) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar