你是要统计个数。还是?直接case when 再结合count
select
tmp.type_name,
sum(case when tmp.偏差='偏小' then 1 else 0 end ) as 偏小,
sum(case when tmp.偏差='偏大' then 1 else 0 end ) as 偏大,
sum(case when tmp.偏差='正常' then 1 else 0 end ) as 正常
from (
SELECT
'颈围' as type_name,
--customer_neck AS 客户颈围,
JWPC AS 偏差
FROM
customer_measure
union all
select
'胸围' as type_name,
--customer_chest AS 客户胸围,
XWPC AS 偏差
from customer_measure
) tmp