title: MYSQL tie handling not returning proper results
body: <p>I'm working with MYSQL and trying to work within the ability of MYSQL of ties for ranking purposes.</p>
  
  <p>my query is:</p>
  
  <pre><code>    SELECT petz.s_name,
         petz.breed,
         a.num,
         sum(a.rank) AS rank
  FROM wins_conf a
  JOIN
    (SELECT DISTINCT rank
     FROM wins_conf
     ORDER BY rank DESC LIMIT 10) b ON a.rank = b.rank
  JOIN petz ON a.num=petz.num
  GROUP BY petz.num
  ORDER BY petz.breed,
           rank DESC
  </code></pre>
  
  <p>which returns the results:</p>
  
  <pre><code>                                                                  sum(Rank)
  INSANITY'S ACE OF SPADES           Collie          1026           58
  INSANITY'S SAVE ME                 Collie          1000           31
  STAR GAZER'S BEAUTIFUL LIES        Collie          1039           24
  BANYON'S ALL IS FORGIVEN           Collie          1009           19
  FELIXTOWE CHERRY BLOSSOM           Collie          1214           18
  KE'S PRICELESS FIGUREINE           Collie          1004           13
  NOVABLUE'S LOVES UNENDING LEGACY   Collie          1211           12
  STAR GAZER'S WARRIOR OF MY HEART   Collie          1059            9
  INSANITY'S BE MINE                 Collie          1028            9
  STAR GAZER'S A WILDCAT'S REVENGE   Collie          1040            5
  KE'S TRICKS OF THE TRADE           Collie          1005            5
  </code></pre>
  
  <p>record 1059 (STAR GAZER'S WARRIOR OF MY HEART) returns 9 as the rank, however it should be 12 based on the records within the DB that are being sum()</p>
  
  <pre><code>                                                       Rank
  conf    33    13    1059    Best of Breed    0    0    5    0   2
  conf    78    3139  1059    Best of Breed    0    0    4    0   2
  conf    82    2518  1059    Best of Breed    0    0    1    0   2
  conf    81    13    1059    Best in Specialty0    0    1    0   2
  conf    79    13    1059    Best of Breed    0    0    1    0   2
  </code></pre>
  
  <p>With some investigating i've found that it will only see the last 3 records to sum(), of the rank column, if the 1's are great than or equal to 4</p>
  
  <p>Any suggestions on how to correct this?</p>
  
  <hr>
  
  <p>EDIT/UPDATE in reply to AgRizzo
  I've just removed the full names and breed for easier reading, this is what I'm wanting, rank wise.  I want to display ranks, with duplicates but only 10 (including their duplicates).</p>
  
  <pre><code>     num          rank
  1    1026         58
  2    1000         31
  3    1039         24
  4    1009         19
  4    1214         19
  5    1004         13
  6    1211         12
  6    1059         12
  7    1028          9
  8    1005          5
  8    1040          5
  9    1010          3
  10    1276          1
  </code></pre>
  
  <hr>
  
  <p>I setup some basic data here: <a href="http://sqlfiddle.com/#!2/7e2992" rel="nofollow">http://sqlfiddle.com/#!2/7e2992</a>
  It's missing some of the fluff content as seen above, but that content isn't needed within the ranking.</p>