ORACLE 行列转换问题

cloud1215 2011-04-29 10:41:24
select ID,TERM,score as china from cloud2012 where subject='china'
union all
select ID,TERM,score as math from cloud2012 where subject='math'
union all
select ID,TERM,score as english from cloud2012 where subject='english'
请问怎么行列合并,我想使用这种方法进行行列转换。
在存储过程中如何写转换的SQL。
...全文
24 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
快溜 2011-04-29
  • 打赏
  • 举报
回复

--mssql
select ID,TERM,max(case when subject='china' then score end) as china,
max(case when subject='math' then score end) as math,
max(case when subject='english' then score end) as english
from cloud2012 group by ID,TERM
快溜 2011-04-29
  • 打赏
  • 举报
回复
去ORACLE版块问问。

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧