RE: [PHP-DB] Question about COUNT(*)

2005-07-07 Thread Erick Wellem
Thanks Rory, This query solves the problem: SELECT client.client_name, IFNULL( COUNT( sales.sale_id ) , 0 ) AS total FROM CLIENT LEFT JOIN sales ON client.client_id = sales.client_id GROUP BY client.client_name ORDER BY total DESC Also thanks to Nandar and Prabhu, but MySQL does not recognize

[PHP-DB] Question about COUNT(*)

2005-07-06 Thread erick
Hi, Let's say that I have 2 tables: client and sales --- | client_id | client_name | --- | 1 | John| | 2 | Mark| | 3 | Luke| | 4 | Matthew | ---

Re: [PHP-DB] Question about COUNT(*)

2005-07-06 Thread Nandar
: [PHP-DB] Question about COUNT(*) Hi, Let's say that I have 2 tables: client and sales --- | client_id | client_name | --- | 1 | John| | 2 | Mark| | 3 | Luke| | 4 | Matthew

Re: [PHP-DB] Question about COUNT(*)

2005-07-06 Thread Rory McKinley
[EMAIL PROTECTED] wrote: Hi, Let's say that I have 2 tables: client and sales --- | client_id | client_name | --- | 1 | John| | 2 | Mark| | 3 | Luke| | 4 | Matthew |