Peter,

I totally appreciate the extra effort on this one!

Just so you know, the results come back as two records
per client. Like this:

| ClientName | Status | Count |
| Steve      | 2      | 25    |
| Steve      | 3      | 83    |
| Gary       | 2      | 12    |
| Gary       | 3      | 33    |

This is close enough to the solution I was looking for
that I can proceed from here!

Thanks a million!

John



>OK, this time tested :)
>
>SELECT Clients.ClientName, Ratings.Status, Count(*)
FROM Clients LEFT 
>JOIN
>Ratings ON Clients.ID = Ratings.ClientID
>GROUP BY ClientName, Ratings.Status
>HAVING Ratings.Status = 2 OR Ratings.Status = 3
>
>regards,
>
>Peter
>Software Engineer / Trainer
>Vervoorn IT
>----- Original Message -----
>From: "Peter Vervoorn" <[EMAIL PROTECTED]>
>To: "php-db list" <[EMAIL PROTECTED]>
>Sent: Thursday, February 14, 2002 9:36 AM
>Subject: Re: [PHP-DB] counting multiple columns based
on different 
>values
>
>
>> This should do the trick (untested):
>>
>> SELECT ClientName, Count(*) FROM Clients LEFT JOIN
Ratings ON 
>Clients.ID =
>> Ratings.ClientID
>> GROUP BY ClientName
>> HAVING Ratings.Status = 2 OR Ratings.Status = 3
>>
>>
>> regards,
>>
>> Peter
>> Software Engineer / Trainer
>> Vervoorn IT


__________________________________________________
Do You Yahoo!?
Got something to say? Say it better with Yahoo! Video Mail 
http://mail.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to