SELECT
cat.CategoryID as CategoryID,
count(p.ProductID) as CountProducts
FROM
Category as cat
LEFT JOIN Products as p on p.CategoryID IN
(SELECT CategoryID FROM Category as cd
WHERE cd.ParrentCategoryID = '876')
WHERE
CategoryID = '876'
ORDER by Name
我们遇到了错误 - “在where子句中的‘CategoryID’列是模糊的”。请告诉我正确的方法。
id
是行业标准,因为它效果最佳。 - Bohemian