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 

enter image description here

but grouping on result not work:

select nth(2,split('first-second','-')) second_part [foo.bar] group second_part limit 10 

enter image description here

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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -