COUNT_IF

Aggregates boolean values. Returns the number of TRUE boolean values.

Parameter Type Description
value
boolean
The values to count
Returns: integer

Example

query:

SELECT COUNT_IF(close_value > 43) AS `# deals with close value > 43`,
       sales_agent
  FROM sales_pipeline
 WHERE deal_stage = "Won"
 GROUP BY sales_agent

result:

# deals with close value > 43 sales_agent
149 Maureen Marcano
100 Boris Faz
171 Jonathan Berthelot
221 Vicki Laflamme
158 Donn Cantrell
55 Wilburn Farren
163 Cassey Cress
77 Elease Gluck