Select sum (NVL (a.y sje, 0) - NVL (a.s kje, 0)) ye, a.c ustcode, a.u nitcode The from (select decode (zb DJDL, ys, sum (fb) Jfbbje), '0') ysje, Decode (zb) DJDL, sk, sum (fb) ybye), '0') skje, Bas custcode, Corp., unitcode The from arap_djzb zb Left the join arap_djfb fb On the zb. VOUCHID=fb. VOUCHID Left the join bd_cumandoc man On man. Pk_cumandoc=fb. Ksbm_cl Left the join bd_cubasdoc bas On bas. Pk_cubasdoc=man. Pk_cubasdoc Left the join bd_corp corp On corp., pk_corp=zb. DWBM Where bas. Custcode='211200127' - substr (bas. The custcode, 0, 2)='21' And the zb. DJZT='2' And corp., unitcode='10301' And NVL (zb. Dr, 0)=0 And NVL (fb. Dr, 0)=0 Group by bas. Custcode, zb DJDL, corp., unitcode) a Group by a.c ustcode, a.u nitcode
Associated with the terms of a few tables, let go also hundreds of data, query up particularly slow, bosses can optimize it
CodePudding user response:
Arap_djzb table? Through DJZT='2' the filtered data volume is how many?