SQL,group by分组后分别计算组内不同值的数量时间:2023-03-09 18:24:18 select name as 姓名,sum( case when cargo='笔' then 1 else 0 end ) as 笔,sum( case when cargo='橡皮' then 1 else 0 end ) as 橡皮from shopping group by name;