count rows taking into account qty <p>I currently get a count by runningthe following command, and parsing it into a custom <code>pdo</code> select function.</p> <p><code>SELECT COUNT(*) FROM foo GROUP BY bar</code></p> <p>Table Structure</p> <pre><code>col1 | col2 | bar | qty ------------------------ blahb blah abc 1 blahb blah abc 3 blahb blah abc 1 blahb blah aaa 3 blahb blah aaa 5 blahb blah aaa 1 </code></pre> <p>This will return:</p> <p><code>abc =&gt; 3 aaa =&gt; 3</code></p> <p>Is there a way of modifying the query so that the <code>qty</code> multiplies the <code>bar</code> column?</p> <p>Desired Result:</p> <p><code>abc =&gt; 5 aaa =&gt; 9</code></p>