You should probably use [recursive common table expressions][1] for this, since it is an SQL standard and available on most SQL database engines, whereas the generate_series() table-valued function is an PostgreSQL-ism. I suppose you are looking for all integers between 1 and 10. (That is not what your generated_series() call does, so I'm having to guess.) The correct code for this is: ~~~ WITH RECURSIVE c(x) AS ( VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<10 ) SELECT x FROM c; ~~~ [1]: https://www.sqlite.org/lang_with.html#recursivecte