
Creator
2020-05-08
12:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to do group by then concat in QS script
How to do group by then concatenate in QS script?
For Example
A B
-----------
A1 B1
A2 B2
A1 B2
A2 B4
I want the result is
A1 B1,B2
A2 B2,B4
I want group by A then concatenate the value in B
In Sql:
SELECT A, LISTAGG(B, ',') WITHIN GROUP (ORDER BY A) AS BFROM table GROUP BY A;
- Tags:
- script
2,739 Views
1 Solution
Accepted Solutions

Partner Ambassador/MVP
2020-05-08
12:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this,
Load A,Concat(B,',') as ConcateField
From XYZ
Group by A;
Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
1 Reply

Partner Ambassador/MVP
2020-05-08
12:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this,
Load A,Concat(B,',') as ConcateField
From XYZ
Group by A;
Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
