SQL _wm_concat function experiment: implement field merging, SQL _wm_concat Field

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.