SQL _wm_concat function experiment: implement field merging, SQL _wm_concat Field
Original Works are from the blog of "Deep Blue blog". You are welcome to reprint them. Please note the following source when reprinting them. Otherwise, you will be held legally liable for copyright.
Deep Blue blog: http://blog.csdn.net/huangyanlong/article/details/41347109
Wm_concat function: field merging function
Purpose: merge other fields based on the same value of a field.
[Experiment]
Use the emp table under the scott user in the experiment
SQL> select * from emp;
-- First, let's take a look at all the content of the emp table.
EMPNO JOB MGR HIREDATE SAL COMM DEPTNO ENAME
----------------------------------------------------------------------------------
7369 CLERK 7902 800.00 20
7499 DBA 7698 1600.00 300.00 30
7521 DBA 7698 1250.00 500.00 30
7566 MANAGER 7839 2975.00 20
7654 DBA 7698 1250.00 1400.00 30
7698 DBA 7839 2850.00 30
7782 MANAGER 7839 2450.00 10
7788 ANALYST 7566 1987/4/19 3000.00 20
7839 PRESIDENT 1981/11/17 5000.00 10
7844 DBA 7698 1500.00 0.00 30
7876 CLERK 7788 1987/5/23 1100.00 20
7900 DBA 7698 950.00 30
7902 ANALYST 7566 3000.00 20
7934 CLERK 7782 1982/1/23 1300.00 10
14 rows selected
SQL> select DEPTNO, wm_concat (job) jobs from emp group by deptno;
-- View the names of all positions in the same department
DEPTNO JOBS
---------------------------------------------------------------------------
10 MANAGER, CLERK, PRESIDENT
20 CLERK, ANALYST, CLERK, ANALYST, MANAGER
30 DBA, DBA
Original Works are from the blog of "Deep Blue blog". You are welcome to reprint them. Please note the following source when reprinting them. Otherwise, you will be held legally liable for copyright.
Deep Blue blog: http://blog.csdn.net/huangyanlong/article/details/41347109