首先让我们来看看这个神奇的函数wm_concat(列名),该函数可以把列值以","号分隔起来,并显示成一行,接下来上例子,看看这个神奇的函数如何应用 准备测试数据 SQL> create table test(id number,name varchar2(20)); SQL> insert into test values(1,'a'); SQL> insert into test values(1,'b'); SQL> insert into test va
这就是典型的行转列问题. 首先说下最简单的思路 用union all select year,sum(m1) m1,sum(m2) m2,sum(m3) m3,sum(m4) m4 from ( select year,count m1,0 m2,0 m3,0 m4 from atest where month = 1 union all select year,0 m1,count m2,0 m3,0 m4 from atest where month = 2 union all selec
首先让我们来看看这个神奇的函数wm_concat(列名),该函数可以把列值以","号分隔起来,并显示成一行,接下来上例子,看看这个神奇的函数如何应用 准备测试数据 SQL> create table test(id number,name varchar2(20)); SQL> insert into test values(1,'a'); SQL> insert into test values(1,'b'); SQL> insert into test va
--本次因工作需要,为其他部门提供部分表数据,创建一个新用户与表空间.--system用户下drop user sys_outside cascade;drop tablespace sys_outside including contents and datafiles; create tablespace sys_outside datafile '/u01/app/oracle/oradata/dbxxx/sys_outside.dbf' size 100M autoextend on n