分组展示sql server

selectname,MAX(语文)语文,sum(数学)数学,sum(英语)英语from

(

select*

fromtestasC

PIVOT(MAX(score)FORcourseIN([语文],[数学],[英语]))AST

)r

groupbyname

orderbycount(name)DESC

相关推荐