日期:2014-05-17  浏览次数:21242 次

如何用sql语句返回近一年中每月的数据统计?
比如,有个表中有个date字段,如何用sql返回近一年中每个月的数据量count(*),能用sql语句做到吗?谢谢大家帮忙..

------解决方案--------------------
select to_char(date1, 'yyyy/mm '),count(*) from table1
group by to_char(date1, 'yyyy/mm ')
------解决方案--------------------
近一年的就

select to_char(foccurdate, 'yyyy/mm ') d,count(*) c from wz_enterbill eb
where eb.foccurdate> =add_months(sysdate,-11)
group by to_char(foccurdate, 'yyyy/mm ')