时间:2021-07-01 10:21:17 帮助过:69人阅读
欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 oracle统计无记录时写默认值 select nvl(max(t1.packagesize),0) from ( select decode(count(t.per_bus_code),0,'1') per_bus_code,decode(count(t.buss_code),0,'1') buss_code,decode(count(t.pe
欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入
oracle统计无记录时写默认值
select nvl(max(t1.packagesize),0)
from (
select decode(count(t.per_bus_code),0,'1') per_bus_code,decode(count(t.buss_code),0,'1') buss_code,decode(count(t.per_code),0,'1') per_code
from t_tybook_back_pers_business t
where t.per_code = 'TY-00000106'
and t.end_date > sysdate
and t.start_date<=sysdate ) t
left join t_tybook_before_business t1 on t.buss_code = t1.code
group by t.per_code;