All pastes #806123 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-12-04 23:44 UTC
rendered paste body
Ok I have the following mysql code
SELECT
`jos_eventlist_categories`.`id` AS `catID`,
`jos_eventlist_categories`.`catname` AS `catName`,
Count(`jos_eventlist_dates`.`catsid`) AS `numEvents`
FROM
`jos_eventlist_categories`
Left Join `jos_eventlist_dates` ON `jos_eventlist_dates`.`catsid` = `jos_eventlist_categories`.`id`
WHERE published = 1 && publishedcat = 1 && unix_timestamp(enddates) >= '1195974000'
GROUP BY
`jos_eventlist_dates`.`catsid`,
`jos_eventlist_categories`.`catname`
ORDER BY
`numEvents` DESC,
`jos_eventlist_categories`.`catname` ASC
works great but the where clause reduces the results down to just the valid ones (there is the problem) I need catName to return all catNames regardless of the where clause and only have the where clause applied to the Count?