SELECt Category, COUNT(*) AS Total , (COUNT(*) / (SELECT COUNT(*) FROM Item WHERe Department='Popular')) * 100 AS 'Percentage to all items', FROM ItemWHERe Department='Popular'GROUP BY Category;
我不确定MySql的语法,但是可以使用如图所示的子查询。
欢迎分享,转载请注明来源:内存溢出
SELECt Category, COUNT(*) AS Total , (COUNT(*) / (SELECT COUNT(*) FROM Item WHERe Department='Popular')) * 100 AS 'Percentage to all items', FROM ItemWHERe Department='Popular'GROUP BY Category;
我不确定MySql的语法,但是可以使用如图所示的子查询。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)