Ben Hamilton

MySQL – Counting how many rows have a particular value

Working on a¬†SugarCRM dashboard today, and I needed to count how many records had one value and how many records had a second value. I then wanted to know what percentage the first value was of the total. So there’s a bit of MySQL code that helps make this easy to do. SELECT SUM(IF(field_name = […]

Posted in SugarCRM | Tagged , , , | Comments Off on MySQL – Counting how many rows have a particular value