select m.地市,sum(未中次数) 未中次数,sum(中标次数) 中标次数
from (
select 地市,count(*) 未中次数,0 as 中标次数 from table where 中标状态='未中标'
group by 地市
union all
select 地市,0 as 未中次数,count(*) 中标次数 from table where 中标状态='中标'
) m
select city,win_state ,count(1) from 表名
group by city,win_state
order by city,win_state
在city加个distinct不就可以把重复的去掉了,如果想要知道有多少重复的,再用数字算一下就可以了
具体你想统计啥?