All possible unique combination of a single column value partitioned by groups

I have a table like the following in Google BigQuery. I am trying to get all possible unique combination(all subsets except the null subset) of the Item column partitioned on Group.

Group   Item
1       A
1       B
1       C
2       X
2       Y
2       Z

I am looking for an output like the following:

Group   Item
1        A
1        B
1        C
1        A,B
1        B,C
1        A,C
1        A,B,C
2        X
2        Y
2        Z
2        X,Y
2        Y,Z
2        X,Z
2        X,Y,Z

I have tried to use this accepted answer to incorporate Group to no avail: How to get combination of value from single column?



from Recent Questions - Stack Overflow https://ift.tt/3Gffhpy
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)