Fix Ranking Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pipi
    New Member
    • Dec 2015
    • 1

    Fix Ranking Query

    In the query, ties are given the same rank:

    1.Salesperson Division NumberSold Rank
    2. Robert Electronics 99 2
    3. Jenny Electronics 54 4
    4. Billy Appliances 54 4
    5. Karen Appliances 102 1
    6. Kim Appliances 30 5

    So in this case Jenny and Billy are both ranked 4.
    But actually they should both be ranked 3
    Then nobody is 4 and Kim is 5.

    Any fast way of fixing this ?

    Thanks for the great post though !
    Last edited by zmbd; Dec 17 '15, 07:37 PM. Reason: [z{moved your question from the article. We try to keep those threads to direct questions :) }]
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Take out the equal sign and add one to the count.

    Comment

    • zmbd
      Recognized Expert Moderator Expert
      • Mar 2012
      • 5501

      #3
      Relocated this post from Rabbit's insight article located at:
      Ranking Queries in MS Access SQL

      If you are still having issues with this after Rabbit's suggestion we may need to see your SQL.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32645

        #4
        Hi Rabbit.

        You may want to update your article to incorporate this. Pipi's point is a good one. Two equal values that are both less than the top two values are generally given a ranking of 3 and not 4.

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          Good idea, I'll do so

          Comment

          Working...