Oracle's Wm_concat function ___ static function

Source: Internet
Author: User


Turn from: http://database.51cto.com/art/201010/231126.htm


The Oracle Wm_concat (column) function is what we often use, and here's how you can use the Oraclewm_concat (column) function to implement a field merge if you are wm_concat for Oracle (column) If you are interested in using a function, look at it.

Shopping

-----------------------------------------

U_ID Goods num

------------------------------------------

1 Apple 2

2 Pears 5

1 Watermelon 4

3 Grape 1

3 Banana 1

1 Orange 3

=======================

The results you want are:

--------------------------------

u_id Goods_sum

____________________

1 apples, watermelon, oranges

2 Pears

3 Grapes, Banana

---------------------------------

Select u_id, Wmsys.wm_concat (goods) Goods_sum from
Shopping  

Desired result 2:

--------------------------------

u_id Goods_sum

____________________

1 apples (2 kg), watermelon (4 kg), Orange (3 kg)

2 pears (5 kg)

3 grapes (1 kg), banana (1 kg)

---------------------------------

Implemented using the Oracle Wm_concat (column) function:

Select u_id, wmsys.wm_concat (Goods | | ' (' | | ' kg ') goods_sum from
Shopping


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.