Postgresql generate_series of months
问题 I'm trying to generate a series in PostgreSQL with the generate_series function. I need a series of months starting from Jan 2008 until current month + 12 (a year out). I'm using and restricted to PostgreSQL 8.3.14 (so I don't have the timestamp series options in 8.4). I know how to get a series of days like: select generate_series(0,365) + date '2008-01-01' But I am not sure how to do months. 回答1: select DATE '2008-01-01' + (interval '1' month * generate_series(0,11)) Edit If you need to