select tp 序号 , 数量 = count(*) from
(
select tp1 tp from tb
union all
select tp2 tp from tb
union all
select tp3 tp from tb
union all
select tp4 tp from tb
) t
group by tp