我有以下查询:
SELECT products_categories.categoryID, name, COUNT(*) AS itemCount
FROM products_categories
LEFT JOIN products_to_categories ON products_to_categories.categoryID = products_categories.categoryID
GROUP BY products_categories.categoryID
但是仍然存在一个问题:其中没有产品的类别返回itemCount = 1
而不是0
. 我怎样才能解决这个问题?