sql count with a condition code example
Example 1: condition in count sql
select count(case Position when 'Manager' then 1 else null end)
from ...
select sum(case Position when 'Manager' then 1 else 0 end)
from ...
Example 2: SQL only show where count is great than 1
SELECT COUNT( * )
FROM agents
HAVING COUNT(*)>1; --count is greater than 1