SELECT * FROM generate_serIEs('2008-01-01 00:00'::timestamp,'2009-01-01 12:00','1 quarter');
是什么让季度如此特别?否则generate_serIEs()适用于几乎所有事情,从微秒到千禧年:
select * from generate_serIEs('2008-01-01 00:00'::timestamp,'2008-01-01 00:00:00.001','1 microsecond');select * from generate_serIEs('2008-01-01 00:00'::timestamp,'2008-01-01 00:01','1 second');select * from generate_serIEs('2008-01-01 00:00'::timestamp,'2008-01-01 01:00','1 minute');select * from generate_serIEs('2008-01-01 00:00'::timestamp,'2008-01-01 12:00','1 hour');select * from generate_serIEs('2008-01-01 00:00'::timestamp,'1 day');select * from generate_serIEs('2008-01-01 00:00'::timestamp,'1 week');select * from generate_serIEs('2008-01-01 00:00'::timestamp,'1 month');select * from generate_serIEs('2008-01-01 00:00'::timestamp,'1 year');select * from generate_serIEs('2008-01-01 00:00'::timestamp,'1 decade');select * from generate_serIEs('2008-01-01 00:00'::timestamp,'1 century');select * from generate_serIEs('2008-01-01 00:00'::timestamp,'1 millennium');
如果不能使用季度,那么最好的其他选择是什么?现在,我有:
select date_trunc('quarter',generate_serIEs) gs from generate_serIEs('2008-01-01 00:00'::timestamp,'1 month') group by gsorder by gs;解决方法 不应该这样做你期望的:
SELECT * FROM generate_serIEs('2008-01-01 00:00'::timestamp,'3 months');
结果:
generate_serIEs --------------------- 2008-01-01 00:00:00 2008-04-01 00:00:00 2008-07-01 00:00:00 2008-10-01 00:00:00 2009-01-01 00:00:00(5 rows)总结
以上是内存溢出为你收集整理的在Postgresql中生成一系列的季度全部内容,希望文章能够帮你解决在Postgresql中生成一系列的季度所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)