zoukankan      html  css  js  c++  java
  • oracle-行转列

    --范例1

    select 10 deptno_case10,

           (select distinct case deptno

                              when 10 then

                               listagg(empno, ',') within group(order by ename)

                              else

                               null

                            end deptno

              from emp

             where deptno = 10

             group by deptno) name_case1,

           20 deptno_case20,

           (select distinct case deptno

                              when 20 then

                               listagg(empno, ',') within group(order by ename)

                              else

                               null

                            end deptno

              from emp

             where deptno = 20

             group by deptno) name_case2,

           30 deptno_case30,

           (select distinct case deptno

                              when 30 then

                               listagg(empno, ',') within group(order by ename)

                              else

                               null

                            end deptno

              from emp

             where deptno = 30

             group by deptno) name_case3

      from emp

     

     where rownum < 2

     group by deptno;

     

     

    select deptno,listagg(empno,',') within group (order by ename) ename123 from emp group by deptno;

     

     

     

     

    --范例2

    select deptno,listagg(empno,',') within group (order by ename) ename123 from emp group by deptno;

     

     

  • 相关阅读:
    CentOS7使用firewalld打开关闭防火墙与端口
    ssh连接卡在【To escape to local shell, press 'Ctrl+Alt+]'.】的解决方法
    本地链路地址
    RIFF和WAVE音频文件格式
    声音分贝的概念,dBSPL.dBm,dBu,dBV,dBFS
    VS中C++ 项目重命名
    FFmpeg学习6:视音频同步
    FFmpeg学习5:多线程播放视音频
    FFmpeg学习4:音频格式转换
    FFmpeg数据结构:AVPacket解析
  • 原文地址:https://www.cnblogs.com/iyoume2008/p/5869153.html
Copyright © 2011-2022 走看看