Contest rank by class

R

Rmynhier

This query is ranked by [Caption Total](All classes) from qryPrelims but I
want it ranked only on [Caption Total] for [Class]=A

SELECT qryPrelims.[Prelim Order], qryPrelims.School, qryPrelims.[Metro
School], qryPrelims.Class, qryPrelims.Division, qryPrelims.PrelimMusicTotal,
qryPrelims.PrelimVisualTotal, qryPrelims.PrelimEffectTotal,
qryPrelims.[Points Deduction], qryPrelims.[Caption Total],
(SELECT Count(*) FROM qryPrelims AS Q WHERE qryPrelims.[Caption Total] <=
Q.[Caption Total]) AS Rank
FROM qryPrelims
WHERE (((qryPrelims.Class)="A"))
ORDER BY qryPrelims.[Caption Total] DESC;
 
M

Marshall Barton

Rmynhier said:
This query is ranked by [Caption Total](All classes) from qryPrelims but I
want it ranked only on [Caption Total] for [Class]=A

SELECT qryPrelims.[Prelim Order], qryPrelims.School, qryPrelims.[Metro
School], qryPrelims.Class, qryPrelims.Division, qryPrelims.PrelimMusicTotal,
qryPrelims.PrelimVisualTotal, qryPrelims.PrelimEffectTotal,
qryPrelims.[Points Deduction], qryPrelims.[Caption Total],
(SELECT Count(*) FROM qryPrelims AS Q WHERE qryPrelims.[Caption Total] <=
Q.[Caption Total]) AS Rank
FROM qryPrelims
WHERE (((qryPrelims.Class)="A"))
ORDER BY qryPrelims.[Caption Total] DESC;

If you want to rank by class, then start with something more
like:

SELECT [Prelim Order], School, [Metro School],
Class, Division, PrelimMusicTotal,
PrelimVisualTotal, PrelimEffectTotal,
[Points Deduction], [Caption Total],
(SELECT Count(*)
FROM qryPrelims AS Q
WHERE Q.Class = qryPrelims.Class
And Q.[Caption Total] <= qryPrelims.[Caption Total]
) AS Rank
FROM qryPrelims
ORDER BY [Caption Total] DESC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top