SELECT jos_mod_gdwcomm.*, COUNT(jos_mod_gdwcomm_spam.reportid) `num_spam`
FROM `jos_mod_gdwcomm`
WHERE `num_spam` > 0
LEFT JOIN `jos_mod_gdwcomm_spam`
ON (jos_mod_gdwcomm.id = jos_mod_gdwcomm_spam.commid)
GROUP BY jos_mod_gdwcomm.id
ORDER BY `num_spam` DESC, jos_mod_gdwcomm_spam.datetime DESC
How can i modify this query so it only returns the rows that num_spam is greater than 0.
i tryed putting
WHERE `num_spam` > 0
In a few places but no luck.
Thanks