问题描述
- wm_concat()内排序问题
- 期望: wm_concat()内的按col6排序
with t as (select 'A' as col1'李四' as col2,'1' as col3'2015-04-15' as col5'2015-04-15 16:30:30' as col6 from dualunionselect 'B' as col1'李四' as col2,'2' as col3'2015-04-15' as col5'2015-04-15 16:31:30' as col6 from dualunionselect 'C' as col1'李四' as col2,'3' as col3'2015-04-15' as col5'2015-04-15 16:31:50' as col6 from dualunionselect 'AA' as col1'李四' as col2,'2' as col3'2015-04-14' as col5'2015-04-15 16:30:10' as col6 from dualunionselect 'BB' as col1'李四' as col2,'3' as col3'2015-04-14' as col5'2015-04-15 16:31:20' as col6 from dualunionselect 'CC' as col1'李四' as col2,'2' as col3'2015-04-14' as col5'2015-04-15 16:31:30' as col6 from dualunionselect 'X' as col1'张三' as col2,'1' as col3'2015-04-15' as col5'2015-04-15 16:31:50' as col6 from dualunionselect 'Y' as col1'张三' as col2,'1' as col3'2015-04-15' as col5'2015-04-15 16:50:50' as col6 from dualunionselect 'Z' as col1'张三' as col2,'3' as col3'2015-04-15' as col5'2015-04-15 16:51:50' as col6 from dualunionselect 'M' as col1'王五' as col2,'3' as col3'2015-04-15' as col5'2015-04-15 16:31:50' as col6 from dual)select wm_concat(col1)col2col5sum(to_number(col3)) from (select * from t order by col6 asc) group by col5col2 order by col5 desc
解决方案
运行结果:(http://img.ask.csdn.net/upload/201504/15/1429093463_855489.png)
期望结果:http://img.ask.csdn.net/upload/201504/15/1429093541_277704.png)
时间: 2024-10-31 17:25:19