你的位置:首页 > 软件开发 > 数据库 > SQL 行转列

SQL 行转列

发布时间:2016-07-04 19:00:09
行转列表结构:subject 科目yw 语文sx 数学表数据:转换SQL:1 select name, 2 max(case subject when yw then score else end) as yw , 3 max(case subject when sx ...

行转列

表结构:

SQL 行转列

subject 科目

yw 语文

sx 数学

表数据:

SQL 行转列

转换SQL

1 select name, 2 max(case subject when 'yw' then score else '' end) as yw , 3 max(case subject when 'sx' then score else '' end) as sx 4 from student_score group by name

原标题:SQL 行转列

关键词:sql

sql
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。