2015-09-26 47 views

回答

0

请按如下所示尝试:根据需求添加where子句。

SELECT component,count(comp_details) FROM table where comp_details is not null and comp_details != "" GROUP BY component 
+0

不应该是'comp_details不为空AND comp_details!=“”'? – mynawaz

2

虽然要有条件地又算你的查询没有任何WHERE部分

SELECT component,count(comp_details) 
FROM table 
WHERE IFNULL(component, '') != '' 
GROUP BY component