a_type,as_type具体啥意思不懂
如果是按日你也可以group by time
按月就 group by substr(time,1,6)
至于这个 申请数量 申请通过数量 申请不通过数量
就是 sum(decode(type,1,1,0,0,1)) 应该可以实现
如
select time,sum(decode(type,1,1,0)),sum(decode(type,0,1,0))
from table
group by time
如果是按日你也可以group by time
按月就 group by substr(time,1,6)
至于这个 申请数量 申请通过数量 申请不通过数量
就是 sum(decode(type,1,1,0,0,1)) 应该可以实现
如
select time,sum(decode(type,1,1,0)),sum(decode(type,0,1,0))
from table
group by time
0 代表 待 审核
1 代表 审核 通过
2 代表 审核 不通过
sum(decode(a_type,1,1,0)) as 审核 通过,
sum(decode(a_type,2,1,0)) as 审核 不通过
from table
where substr(time,1,6)='201001'
group by time
我觉得考虑的不是重复数据 而是那天或是那月没数据 是否要填充
什么意思呀,这是第一次用Oracle 好多东西都不会呀