Instructions for using Oracle function Listagg

Source: Internet
Author: User

Instructions for using Oracle function Listagg

At work, customers often come up with the requirement that they want to enumerate the dates one by one in a summary merge.

, the original data is this:

Customers want to be able to achieve such a summary consolidation:


So I usually use the Listagg function, but a lot of the online system is a comprehensive introduction Listagg the use of this function, looks very laborious. I'm here to explain briefly.

The statement that implements the requirement is this:
Select Name,
Listagg (Ddate, '/') within group (order by name) as Ddate
From AA
Group BY name

Things to note are as follows:
1. A scoring group is required, i.e. group by is required.
2. The first parameter of the Listagg function is the field that needs to be enumerated, that is, ddate; the second argument is the delimiter between the enumeration values, and it also needs to be sorted and grouped within group (order by name)

Instructions for using Oracle function Listagg

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.