Nope. First of all, when you do COUNT(state)
then, unless some of the records in your text
table have *NULL* state values, then you will get *exactly* the same answer as if you did
SELECT COUNT(*) AS num FROM test WHERE country = 'us'
In other words the TOTAL COUNT OF ALL records that match on country = 'us'
. ONE SINGLE NUMBER. Period.
In short, COUNT(state) does not *AT ALL* mean what you think it means.
I *think* that what you are after is this:
SELECT state, COUNT(*) AS num FROM test
GROUP BY state
ORDER BY state
And that will give you records such as
.. etc. ...
But of course now you won't want to use implode
, more than likely.
I'm not sure why you ever wanted to use implode
in the first place. What use is it?