sql行转列问题
- 行
- 列
select name ,sum(case when course='语文' then score end) as 语文,
sum(case when course='数学' then score end )as 数学,
sum(case when course='英语' then score end )as 英语
from score group by name;
select name ,sum(case when course='语文' then score end) as 语文,
sum(case when course='数学' then score end )as 数学,
sum(case when course='英语' then score end )as 英语
from score group by name;