您可以使用以下方法创建去年(例如)的所有前几天的列表
select distinct date_trunc('month', (current_date - offs)) as date from generate_series(0,365,28) as offs; date------------------------ 2007-12-01 00:00:00+01 2008-01-01 00:00:00+01 2008-02-01 00:00:00+01 2008-03-01 00:00:00+01 2008-04-01 00:00:00+02 2008-05-01 00:00:00+02 2008-06-01 00:00:00+02 2008-07-01 00:00:00+02 2008-08-01 00:00:00+02 2008-09-01 00:00:00+02 2008-10-01 00:00:00+02 2008-11-01 00:00:00+01 2008-12-01 00:00:00+01
然后,您可以加入该系列。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)