MySQL Forums
Forum List  »  PHP

Re: Query Problem
Posted by: Peter Brawley
Date: March 21, 2006 08:50AM

To count the zeroes you need a left join:

SELECT u.name, COUNT( h.name) As fault_count
FROM users u
LEFT JOIN history h USING (name)
GROUP BY u.name
ORDER BY fault_count DESC ;

Options: ReplyQuote


Subject
Written By
Posted
March 21, 2006 03:15AM
Re: Query Problem
March 21, 2006 08:50AM
March 22, 2006 04:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.