SQL 栏位排序

冰痕001 2020-04-05 10:59:58
如下图,根据栏位进行排序:
每一行对a_time,b_time,c_time,d_time,e_time 进行排序,排序结果放在Reltestseq栏位。
例如:SAM 如果a_time<=b_time<=c_time<=d_time<=e_time 则在Reltestseq 栏位放a,b,c,d,e或者1,2,3,4,5都可以


...全文
100 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
冰痕001 2020-04-06
  • 打赏
  • 举报
回复
with t001 as ( select id,'A' AS ORDERS,a_testtime as test_time FROM testSortseq UNION ALL select id,'B' AS ORDERS,B_testtime as test_time FROM testSortseq UNION ALL select id,'C' AS ORDERS,C_testtime as test_time FROM testSortseq UNION ALL select id,'D' AS ORDERS,D_testtime as test_time FROM testSortseq UNION ALL select id,'E' AS ORDERS,E_testtime as test_time FROM testSortseq ) select id,listagg(orders,',')within group(order by test_time) seqs from t001 group by id order by id

3,491

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 高级技术相关讨论专区
社区管理员
  • 高级技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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