Skip to content
Advertisement

Repeat Rows certain amount of times for columns

I have this table:

I want to be able to self-generate data for each car and city for 24 months cycle, more like auto-increment.

What I am looking for:

How can I do this in postgreSQL?

Advertisement

Answer

You can try to use generate_series with CROSS JOIN a subquery.

Query 1:

Results:

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