Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
vvvvvvvvvv
Creator
Creator

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;

 

Labels (3)
1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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!

View solution in original post

1 Reply
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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!