SELECT b.tax_pch,COUNT(IF(b.tax_status IN(0,1,2),TRUE ,NULL))AS '总人数',
COUNT(IF(b.tax_status IN (0,1),TRUE ,NULL))AS '未报人数',
COUNT(IF(b.tax_status = 2,TRUE ,NULL))AS '已报人数',
b.tax_model,b.tax_company,
SUM(IF(b.tax_status IN(0,1,2),tax_pay ,0) ) AS '应报税金额总计',
SUM(IF(b.tax_status IN(0,1),tax_pay ,0) ) AS '已报税金额',
SUM(IF(b.tax_status =2,tax_pay ,0) ) AS '未报税金额'
FROM tax_bill b WHERE 1=1 GROUP BY tax_pch