我有一个包含以下列的年份数据的表:
Table "myData" ((
"Status" character varying,
"Project" character varying,
"Product" character varying,
"Identifier" character varying,
"Submittedon" date
)
ETC。,
现在获取在特定月份提交的记录计数。比如说 2013 年 4 月的记录计数,我正在使用:
select count("Status") as April2013
from "myData"
where (
"SubmittedOn" > (current_date - 90)
and "SubmittedOn" < (current_date - 60)
)
结果:
April2013
--------
62
现在我的要求是获取过去 6 个月的记录数。我的意思是我希望我的输出采用以下任何一种格式:
FORMAT 1:
FORMAT 2:
6MonthsCount
-------------
34
23
44
41
18
9