I can't help you david but I would like to add that I myself need the exact same information. I tried using a WHERE statement, like
$query = "SELECT name, COUNT(*) AS count FROM table WHERE count > -1 GROUP BY name ORDER BY name";
include('query.php');
This way I hoped that MySQL would understand that zero is also an answer but it says that count is an unknown collu........Wowowowow... Wait a second.. I know why it fails: a count result of 0 means that there is no entry that holds that name!
For example:
There are 4 persons that work in your office: Peter, Jack, Mike and Patty
At the moment only Peter, Jack and Mike have work. Your "work_table" would look like:
[Name] ------- [Job]
Peter ------- Fix the Kitchen
Peter ------- Connect the tubes
Jack -------- Seal the windows
Mike -------- Fix the doors
A count command would give:
Peter : 2
Jack : 1
Mike : 1
Now why doesn't patty show up? Coz there isn't anyone named Patty in the work_table, so how on earth is MySQL supposed to know that there's also a Patty working in your company?
There are two tricks: one of which I DO know how to use it, and one of which I DON'T.
The trick I know is to give every employee a fake entry which never gets deleted, And THEN use the count funtion, but substract one:
$query = "SELECT name, COUNT(*) - 1 AS count FROM table GROUP BY name ORDER BY name";
This way the name patty is also mentioned in the work_table and will thus show up as an answer. But since patty has only 1 entry (the fake one) the result of the query will be 1-1 = 0 !
The second trick (in my opinion a better solution) is to somehow "force" MySQL to query for a person named Patty. The answer would logically be 0, since Patty is unknown as a name. I've tried this way, but without any luck so far. If anyone else can help?....