select rybh,
'赞成' AS M,count(case when bz='赞成' then 1 else null end) AS A,
'反对' as N,count(case when bz='反对' then 1 else null end) AS B,
'弃权' AS O,count(case when bz='弃权' then 1 else null end) AS C
from gcstptj1
group by rybh
'赞成' AS M,count(case when bz='赞成' then 1 else null end) AS A,
'反对' as N,count(case when bz='反对' then 1 else null end) AS B,
'弃权' AS O,count(case when bz='弃权' then 1 else null end) AS C
from gcstptj1
group by rybh