sql面试题-----行转列
时间:2021-07-01 10:21:17
帮助过:17人阅读
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
执行结果如下图:

sql面试题-----行转列
标签:bsp 试题 http img ima pre .com 技术分享 div