3,491
社区成员
发帖
与我相关
我的任务
分享
with sb_zb as
(select
count(*) c1,
sum(case when sbzt_dm in ('4','5','6','7') then 1 else 0 end ) s1,
sum(case when sbzt_dm in ('4','5','6','7') then 0 else 1 end ) s2
from dzswj.sb_zb
),
kk as (
select sum(t.ynse) s1 from dzswj.sb_kk t where t.sphm is not null
),
fpxx as
(
select
count(distinct nsrdzdah) c1,
COUNT(DISTINCT (case when X.FPZL_DM LIKE '2810%' then X.NSRDZDAH else 0 end ) - 1 c2 ,
sum(case when fpzt_dm in (1, 2) then 1 else 0 end) s1,
sum(case when fpzt_dm in (3, 4) then 1 else 0 end) s2,
sum(case when fpzt_dm in (1, 2) then kpjehj else 0 end) s3
from dzswj.fpxx
)
select
sb_zb.c1,
sb_zb.s1,
sb_zb.s2,
kk.s1,
fpxx.c1,
fpxx.c2,
fpxx.s1,
fpxx.s2,
fpxx.s3
from sb_zb,kk,fpxx
with sb_zb as
(select
count(*) c1,
sum(case when sbzt_dm in ('4','5','6','7') then 1 else 0 end ) s1,
sum(case when sbzt_dm in ('4','5','6','7') then 0 else 1 end ) s2
from dzswj.sb_zb
),
kk as (
select sum(t.ynse) s1 from dzswj.sb_kk t where t.sphm is not null
),
fpxx as
(
select
count(distinct nsrdzdah) c1,
COUNT(DISTINCT (case when X.FPZL_DM LIKE '2810%' then X.NSRDZDAH else 0 end ) - 1 c2 ,
sum(case when fpzt_dm in (1, 2) then 1 else 0 end) s1,
sum(case when fpzt_dm in (3, 4) then 1 else 0 end) s2,
sum(case when fpzt_dm in (1, 2) then kpjehj else 0 end) s3
from dzswj.fpxx
)
select
sb_zb.c1,
sb_zb.s1,
sb_zb.s2,
kk.s1,
fpxx.c1,
fpxx.s1,
fpxx.s2,
fpxx.s3
from sb_zb,kk,fpxx