select '大客户' as bs,
sum(ZZL) as ZZL,
sum(FYJE) as ZJE,
sum(CS) as ZCS
from TB_HP_JBXX
where
zfbj = '0'
and rkdate >=
to_date('2017/11/26 18:00:00', 'yyyy-mm-dd hh24:mi:ss')
and rkdate <=
to_date('2017/11/27 18:00:00', 'yyyy-mm-dd hh24:mi:ss')
and FZLJM = '02'
and
fhrmc in (select fhrmc
from (select fhrmc, sum(zzl) zzl
from TB_HP_JBXX
where zfbj = '0'
and fzmc in
(select DEPTNAME
from TB_AUT_DEPARTMENT_HY
where parentcode = 'DEPT000031')
and rkdate >=
to_date('2016/1/1 18:00:00',
'yyyy-mm-dd hh24:mi:ss')
and rkdate <=
to_date('2017/1/1 18:00:00',
'yyyy-mm-dd hh24:mi:ss')
and FZLJM = '02'
group by fhrmc)
where zzl >= 5000000
)