Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • I'm glad to help Commented Jan 18, 2018 at 14:00
  • @McNets Good answer, but a couple minor points: I wouldn't wrap the GENERATE_SERIES in a CTE, and I wouldn't use plpgsql for this. This is just regular SQL. Commented Jan 18, 2018 at 16:44
  • @McNets dbfiddle.uk/… (feel free to incorporate that into the answer) Commented Jan 18, 2018 at 16:48
  • In the updated answer/fiddle: Where comes CTS from? It would be great, if you could explain that. Thank you!! Commented Jan 23, 2018 at 7:33
  • It's the alias of generate_series(). Commented Jan 23, 2018 at 7:38