oracle存储过程,查询每个月的记录量
「已注销」 2019-08-16 10:12:22 oracle存储过程,查询每个月的记录量:如果当月没有则当月为0,返回是12个月的数据list,
大佬们,有没有会写的?
我之前用的mysql
select(
(select count(0) from xxxx ....) as "1月",
(select count(0) from xxxx ....) as "2月",
(select count(0) from xxxx ....) as "3月",
。。。
)
但是oracle中不能这样写,求大佬,急求
----------------------------
找到一个很简单的方法,但是没有数据的月份就没有月份和数据
select to_char(created_time,'MM') mon,count(*) num from mp_component_info t
where to_char(created_time,'yyyy')='2018'
group by to_char(created_time,'MM')
order by mon
求大佬。。。。。。