Home > other >  What is the analogue of GENERATE_SERIES from Postgres in Presto?
What is the analogue of GENERATE_SERIES from Postgres in Presto?

Time:09-29

I want to write this query in Presto:

    SELECT
        * 
    FROM (
        SELECT GENERATE_SERIES(0, 30) days
    )

But it says that function GENERATE_SERIES doesn't exist in Presto. What can I use instead?

CodePudding user response:

You can use sequence with unnest:

SELECT days
FROM (SELECT sequence(0, 30) as d)
CROSS JOIN UNNEST (d) as t(days) 
  • Related