日期:2014-05-18 浏览次数:20366 次
select field2,count(*) from ( select distinct field1,field2 from tb ) t group by field2
------解决方案--------------------
select sum(case field2 when 1 then 1 end) '1', sum(case field2 when 2 then 1 end) '2', sum(case field2 when 3 then 1 end) '3' from tbl group by field1,field2