条件ごとにCOUNTする

全件と条件ごとの集計を行う。

e.g. 有効な顧客の全数、男女を集計

SELECT
  COUNT(1) AS ALL
  , COUNT(IF(sex='M',1,NULL)) AS MALE
  , COUNT(IF(sex='F',1,NULL)) AS FEMALE
FROM
  customer
WHERE
  delflg=0