BigQuery SPLIT() and grouping by result -
using split()
& nth()
, i'm splitting string value, , taking 2nd substring result. want group on result. however, when use split() in conjunction group by, keeps giving error:
error: (l1:55): cannot group aggregate
the result string, why not possible group on it?
for example, works , returns correct string:
select nth(2,split('first-second','-')) second_part [foo.bar] limit 10
but grouping on result not work:
select nth(2,split('first-second','-')) second_part [foo.bar] group second_part limit 10
my best guess can equivalent result using subquery. :
select * (select nth(2,split('first-second','-')) second_part [foo.bar] limit 10) group second_part
the system returns nth in aggregate internally guess
Comments
Post a Comment