I'm so close but just cant sort it
Basically I have the select
SELECT users.name, COUNT(history.name) as fault_count
FROM users, history
WHERE users.name = history.name
GROUP BY users.name
ORDER BY fault_count DESC
All I'm trying to do is sort an option box with names in by the completed records in the history. But using the above if a user does not have any records in the history then he is not listed even though he is in the users database.
I have the users.name = history.name just to link the fault count to the users name. Is this wrong?
Its like writers block or something I just cant seem to figure a way around this. Can anyone help?
|