Skip to content
Advertisement

How to join generate_series and an array

I want to generate a list of columns using generate_series() and joining it to a specific array (a list of value, e.g. [1, 2, 3]), and my expected result looks like this:

This query:

will give me the result:

Then how to update the query to get the expected result?

Advertisement

Answer

This is one way of many to produce your desired result exactly:

The point being: you need a CROSS JOIN to produce a Cartesian Product.

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