mysql行转换列

利用max(case when then)

表结构:

 

 

select name as 姓名,
max(
case
when subject='语文' then score
end
) as '语文',
max(
case
when subject='数学' then score
end
) as '数学'

from student group by name;

 

posted on 2020-04-26 11:25  Frank-  阅读(260)  评论(0编辑  收藏  举报

导航