I am trying to do view/create the following query in Query Builder and it seems to be dropping the within syntax
here is my query:
SELECT distinct my_KEY, LISTAGG (my_field, ‘|’)
WITHIN GROUP (ORDER BY my_field)
OVER (PARTITION BY My_KEY)
AS my_fields
FROM (select distinct tbl1.my_field, tbl2.KEY as assoc_KEY from tbl2
left join tbl1
on tbl1.my_KEY = tbl2.tbl_1_my_KEY);
Here is what Query Builder converts it to
SELECT distinct my_KEY, LISTAGG (my_field, '|') AS my_fields
FROM ( select distinct tbl1.my_field, tbl2.KEY as assoc_KEY from tbl2
left join tbl1
on tbl1.my_KEY = tbl2.tbl_1_my_KEY);
As you can see, it dropped my within group… and the Over Partition… parts, which won’t run in Query Builder.
I know this seems a bit simple, but this is part of a much larger complex query that I am trying to model out. My Toad version is 12.12.0.39