Skip to content
Advertisement

How to convert X items into array and looping

I have a table with 100k records. I want to create an array for each 10k items and loop this, i.e. first 10k items-> array(first 10k items), then seconds array(10k different items), then third and so on. In other words, each array contains 10k different records.

This is what I tried:

This is the error I get:

Query error: SELECT without FROM clause cannot use analytic functions at [5:5]

I also tried this:

The error I get is:

Query error: Scalar subquery cannot have more than one column unless using SELECT AS STRUCT to build STRUCT values at [5:6]

Advertisement

Answer

Are you looking for something like this

Output enter image description here

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement