我有查询问题。我用postgresql!我需要从日期中提取月份并获取月份的总数,然后将其放入列中
table qwe
----------------------------
tipe | dateissued
----------------------------
a | 8/12/2013
b | 8/12/2013
c | 8/12/2013
d | 9/12/2013
我需要的结果是
----------------------------
tipe | month | totalMonth
----------------------------
a | 8 | 2
b | 8 | 2
c | 8 | 2
d | 9 | 2
“2”总共一个月我从 8 和 9 得到它
到目前为止我已经完成的查询
select tipe , extract(month from dateissued),
count( extract(month from dateissued)) over() as totalMonth
from qwe
group by tipe,dateissued