比如说,我现在数据库数据是个列表,返回十组数据,这十组数据根据每一组的type分为c类跟d类,如何获取到c类跟d类的个数以及总数量呀
select 组字段, (case when type ='C' then 1 else 0 end) as 'c类', (case when type ='D' then 1 else 0 end) as 'd类', count(type) as '总个数' from tabname group by 组字段
sql处理啊,count(c),cound(d),然后呢group by c,d
分组 求个数就可以了啊 设置 type 分组 然后 再另插入一列 设置汇总 求个数就 好了