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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php