我只需要计算那些不为空的行。谢谢。
SELECT component,count(comp_details) FROM table GROUP BY component
最佳答案
虽然您想有条件地计数,但您的查询没有任何 WHERE
部分
SELECT component,count(comp_details)
FROM table
WHERE IFNULL(component, '') != ''
GROUP BY component
关于MYSQL统计不为空的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32793870/