Ranking Problem in Access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Indra Lahiry
    New Member
    • Mar 2012
    • 2

    #1

    Ranking Problem in Access

    I have tried to rank records in Access Table with some criteria.
    In a School DB the will be on the basis of Marks, but the Criteria is the student should be ranked only their own CLASS and SEC.
    I have tried this like....
    SELECT School.ID, School.NAME, School.SCHOOL, School.CLASS, School.SEC, School.MARKS, (SELECT Count(*) FROM School_Marks AS [XX] WHERE [XX].SCHOOL = School_Marks.SC HOOL AND [XX].CLASS = School_Marks.CL ASS AND [XX].SEC = School_Marks.SE C AND [XX].MARKS > School_Marks.MA RKS) AS Rank

    Now there is some problem Like......

    Happening
    Marks Rank
    100 1
    99 2
    99 2
    98 4
    98 4
    97 6
    97 6
    97 6
    96 9

    I Want
    Marks Rank
    100 1
    99 2
    99 2
    98 3
    98 3
    97 4
    97 4
    97 4
    96 5

    If is there any solution please help me......
    Thanking you

    Regards
    Indra Nath Lahiry
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Do the ranking on a distinct version and then join that back to the main table.

    Comment

    Working...