Reputation: 923
I have a table temp_zzz which has:
My expected output is:
dataset pay bitable condt
A B C,E ZZ
P Q D,F YY
I have learned listaggs in oracle,but its not giving me expected output.
I tried is:
SELECT LISTAGG(bitable, ', ') WITHIN GROUP (ORDER BY condt) "Product_Listing"
FROM temp_zzz group by condt;
It gave me :
Product_Listing
D, F
C, E
Is it possbile to get the expected result I expected?
Upvotes: 1
Views: 23
Reputation: 175676
Yes, it is possible:
SELECT dataset,
condt,
MIN(pay) AS pay,
LISTAGG(bitable, ', ') WITHIN GROUP (ORDER BY condt) "Product_Listing"
FROM temp_zzz
group by dataset,condt;
Upvotes: 1