Forum Moderators: open
This works fine, but I only want the total_links to count the links that are set to active.
SELECT COUNT(links.id) AS total_links, categories.id, categories.title FROM categories LEFT JOIN links ON categories.id = links.categoryid WHERE links.active = 1 GROUP BY categories.id
The problem is now that it won't show any categories that have no links to them. Is there a way to do this still in one query or would I need to run a seperate query to calculate the total_links ?