Input:
I have to Convert data from input to output. where we trying if for id freq is n then create n rows of that id.
Output:
Advertisement
Answer
In Presto, one option uses sequence()
and a lateral join to generate the rows:
select t.id, x.value from mytable t cross join lateral unnest(sequence(1, t.freq)) as x(value) order by t.id, x.value