查数据库一个表中的一个行的不同项,肯定要用到【Group By】语法。示例1:查询A列,在表Table_temp中不同项select A from Table_temp group by a示例2:查询A列,在表Table_temp中不同项出现的次数select A,count(0) as 出现次数 from Table_temp group by a...
select max(case t.item1 when 'aa' then count(t.item1) else 0 end) aa,max(case t.item1 when 'bb' then count(t.item1)else 0 end) bb,max(case t.item1 when 'cc' then count(...