I use the following code to count the number of times a text entry appears in a database:
SELECT
Carrier,
Count(case when Carrier='verizon' then 1 else 0 end) AS verizon,
Count(case when Carrier='t-mobile' then 1 else 0 end) AS tmobile,
Count(case when Carrier='sprint' then 1 else 0 end) AS sprint,
Count(case when Carrier='cingular' then 1 else 0 end) AS cingular
FROM `_Incoming_SMS`
GROUP BY Carrier
When I create the Pie Chart the numbers appear correctly, but the Carriers (which is stored in Carrier on the table) only appear as the first color