oracle中行转列语句参考

来源:互联网 发布:软件测试报告模板 编辑:程序博客网 时间:2024/06/06 07:26

建表语句:

drop table test purge;create table test(id number,name varchar2(20),score number);insert into test values(1,'a',95);insert into test values(1,'b',82);insert into test values(1,'c',73);insert into test values(2,'d',56);insert into test values(2,'e',74);commit;



字符类型列合并:

select id 代号,wm_concat(name) 合并结果 from test group by id;


非字符类型列合并:

select id 代号,wm_concat(to_char(score)) 合并结果 from test group by id;









1 0
原创粉丝点击