示例 with tab1 as (select case when(count(su.insu_pkg_id)>0) then 2 else 0 end cnt from ecs_a_bene_insu_p...
示例
with
tab1 as
(select
case
when (count(su.insu_pkg_id)>0) then 2
else 0
end cnt
from
ecs_a_bene_insu_pkg su,ecs_a_bene_pkg pk
where
su.pkg_id=pk.pkg_id and pk.pkg_type=5012 and su.insu_id=367801 and su.status=1
tab2 as
(select
case
when (count(su.insu_pkg_id)>0) then 2
else 0
end cnt
from
ecs_a_bene_insu_pkg su,ecs_a_bene_pkg pk
where
su.pkg_id=pk.pkg_id and pk.pkg_type=5011 and su.insu_id=367801 and su.status=1
select tab1.cnt+tab2.cnt cnt from tab1,tab2