日期:2014-05-16  浏览次数:20401 次

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;

?

?