【发布时间】:2016-07-15 07:45:12
【问题描述】:
我有一个表格“performances”,其中包含“date”和“count”列。 但是,行是稀疏的,即有很多天没有行,这隐含地意味着计数 = 0。 在此运行时有没有可以执行的查询:
date count
2016-7-15 3
2016-7-12 1
2016-7-11 2
会给我这个:
date count
2016-7-15 3
2016-7-14 0
2016-7-13 0
2016-7-12 1
2016-7-11 2
?
【问题讨论】:
-
查看文档 - 特别是
generate_series(): postgresql.org/docs/current/static/functions-srf.html
标签: postgresql