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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a simple numbering of records listed based on sort

Status
Not open for further replies.

zevw

MIS
Joined
Jul 3, 2001
Messages
697
Location
US
this is my Query

Code:
SELECT [LastName] & ", " & [FirstName] AS Mentor, "Self" AS CheckWritten, "Mentor" AS Title, Sum(CaseFinance.AmtPaid) AS SumOfAmtPaid, Count(*) AS [Counter]
FROM Counselors RIGHT JOIN CaseFinance ON Counselors.CounselorId = CaseFinance.CounId
GROUP BY [LastName] & ", " & [FirstName], "Self", "Mentor"
ORDER BY [LastName] & ", " & [FirstName];

My main issue is the count(*) which gives me a count of how many records each name has. I would like to have a simple numbering the first one should be number 1 the second 2 regardless of how many records they have.

I don't know how to do that.

Thanks in advance
 
I would create a new query based on the above, saved query and then use a subquery to provide the ranking number.
Code:
SELECT *, (SELECT Count(*) FROM qryA A where A.Mentor <=qryA.Mentor) as Rank
FROM qryA

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top