Nope, you are wrong.
Let's demonstrate why:
Code:
SELECT d.dragon_id, pm.id AS message_id
FROM user_creature d
LEFT JOIN private_message pm ON pm.to_user = d.user_id
WHERE d.user_id = 4
Don't you get 10 rows from that?
So aren't there 10 rows with a dragon_id? Yes, they are all the same id. But that's irrelevant, to SQL.
So of course when you then do
COUNT(dragon_id) you get 10.
*TRIVIAL* fix:
Code:
SELECT COUNT(DISTINCT d.dragon_id) as dragon_count, COUNT(pm.id) as pm_count
FROM user_creature d
LEFT JOIN private_message pm ON pm.to_user = d.user_id
WHERE d.user_id = 4
LIMIT 1
Hmm??