34,576
社区成员
发帖
与我相关
我的任务
分享
--SQL的行转换为列
case course when '语文' then score else 0 end --(取语文行为一列)
max(case course when '语文' then score else 0 end) 语文 --(分组之后,获得语文这列的最大值(过滤无效的0数据))
cast(avg(score*1.0) as decimal(18,2)) 平均分 --(分组之后,获得每一组的平均值)
sum(score) 总分 --(分组之后,获得每一组的总和值)