title: Using DISTINCT in MySQL
body: <p>I would like a query that selects the total calories and Member ID from my table and order it by the total calories in descending order. I require the first 8 values to be printed out as ranking list, however the way I have designed my program is that every time a new record is added it calls the highest total calories value and then adds the new calculated value to it and stores this as the new total calories value.</p>
  
  <p>This system creates a problem though as when I use this query:</p>
  
  <pre><code>SELECT TotalCalories, MemberID
  FROM TrainingInfo
  ORDER by TotalCalories desc
  LIMIT 0,7
  </code></pre>
  
  <p>It wont fetch the correct amount of values in the case that the member may have two records which are both on the ranking list which I don't want, as I am using the <code>SQL</code> in python for my coursework, I can get rid of duplicate values but it wont give me 8 ranks. I have tried to using <code>DISTINCT</code> however I can't seem to get it to work, the <code>MemberID</code> will be the <code>DISTINCT</code> Value.</p>
  
  <p>If someone could help me with the query that would be great.</p>