我只需要计算那些非空的行。谢谢。
SELECT component,count(comp_details) FROM table GROUP BY component
答案 0 :(得分:2)
虽然您希望有条件地计算,但您的查询没有任何WHERE
部分
SELECT component,count(comp_details)
FROM table
WHERE IFNULL(component, '') != ''
GROUP BY component
答案 1 :(得分:0)
尝试这样:根据要求添加where子句。
SELECT component,count(comp_details) FROM table where comp_details is not null and comp_details != "" GROUP BY component