Skip to content
Advertisement

How to convert data into this form in SQL :

Input:

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:

output

Advertisement

Answer

In Presto, one option uses sequence() and a lateral join to generate the rows:

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