tem数据表如下图
1 select Time as 日期, 2 sum 3 ( 4 case 5 when Shengfu='胜' then 1 6 else 0 7 end 8 ) as 胜, 9 sum 10 ( 11 case 12 when Shengfu='负' then 1 13 else 0 14 end 15 ) as 负 16 17 from tem 18 group by Time
执行结果如下图:
tem数据表如下图
1 select Time as 日期, 2 sum 3 ( 4 case 5 when Shengfu='胜' then 1 6 else 0 7 end 8 ) as 胜, 9 sum 10 ( 11 case 12 when Shengfu='负' then 1 13 else 0 14 end 15 ) as 负 16 17 from tem 18 group by Time
执行结果如下图: