查询首页客户数

-- 1:13888  0:5085  2: 57  null: 149  19179 
SELECT /* rownum r,*/
              *
                  FROM TKHXX TKHXX, XTDC.TFX_KH_SRZHZK B
                 WHERE TKHXX.ID = B.KHID /* and tkhxx.id not in (select m.id from tkhxx m,xtdc.TFX_KH_SRZHZK n where m.id=n.khid and m.khzt=1 and n.cycpje=0 )*/
                   AND NVL(TKHXX.KHZT, 1) <> 3 --剔除已合并的客户
                   AND TKHXX.YYB IN (SELECT ID
                                       FROM LBORGANIZATION
                                     CONNECT BY PRIOR ID = FID
                                      START WITH ID = 1) and B.SCTZRQ>=20190101 AND B.SCTZRQ<=20190930 and  tkhxx.khjl is not null and tkhxx.sfdxkh is null

------0:直销  1:代销  2:单一客户     
--理财经理为空881
--新增客户数:2391   直销客户 144     代销客户: 475  理财经理为空205   单一客户: 1098 理财经理为空15   null:674  客户经理为空 661 
--直销客户+单一客户+是否代销客户为空的  
select (144+1098+674) from dual 
           select  1916-(15+661) from dual 

你可能感兴趣的:(oracle)