Reputation: 35
I need to count only those row that is not empty. thanks.
SELECT component,count(comp_details) FROM table GROUP BY component
Upvotes: 0
Views: 127
Reputation: 11859
try like this:Add a where clause based on requirement.
SELECT component,count(comp_details) FROM table where comp_details is not null and comp_details != "" GROUP BY component
Upvotes: 0
Reputation: 1594
While you want to count conditionally yet your query does not have any WHERE
part
SELECT component,count(comp_details)
FROM table
WHERE IFNULL(component, '') != ''
GROUP BY component
Upvotes: 2