 <p>Okay I thought it all over.. and basically if i do understand correct you want the sum for each distinct set. </p> <blockquote> <p>So not 34 + 34 + 34 + 23 + 23 + 23 + 43 + 43 + 43 ... BUT 34 + 23 + 43</p> </blockquote> <p>In order to that you need to trick MySQL with the following query : </p> <pre><code>SELECT SUM(tot.invalid_votes) AS total FROM (SELECT DISTINCT QV, invalid_votes FROM `results`) tot </code></pre> <p>This will return the SUM of the <em>Distinct</em> values based on QV field.</p> <p>Table : </p> <pre><code>QV invalid_votes 0544 5 0544 5 0544 5 0545 6 0545 6 </code></pre> <p>based on the database information you provided i get the following result <strong>11</strong> </p>