SQLThing correctly analyzed the following query:
SELECT b.arno01 AS CID,ARNM01 AS CN, ARCY01 AS CC, ARST01 AS CS, ARNO07 AS CAP,ARNO08 AS CPP, ARNO09 AS CPF, ifnull(TYSALES.SALES,0), ifnull(TYSALES.cost,0),ifnull(LYSALES.SALES,0), ifnull(LYSALES.cost,0) FROM DS103D.arpmbal b INNER JOIN ds103D.eipmubr k ON (b.arno16=k.branch AND b.arno15=k.company) LEFT OUTER JOIN ( SELECT A.COMPANY, A.BRANCH, A.CUSTOMER, SUM(COST) AS COST, SUM(SALES) AS SALES FROM ds103E.salecust A INNER JOIN ds103e.EIPMUBR B ON (A.COMPANY=B.COMPANY AND A.BRANCH = B.BRANCH) WHERE UID=? AND YR=? GROUP BY A.COMPANY,A.BRANCH,A.CUSTOMER ) AS TYSALES ON (B.ARNO16=TYSALES.BRANCH AND B.ARNO15=TYSALES.COMPANY AND B.ARNO01 = TYSALES.CUSTOMER) LEFT OUTER JOIN ( SELECT A.COMPANY, A.BRANCH, A.CUSTOMER, SUM(COST) AS COST, SUM(SALES) AS SALES FROM ds103E.salecust A INNER JOIN DS103E.EIPMUBR B ON (A.COMPANY=B.COMPANY AND A.BRANCH = B.BRANCH) WHERE UID=? AND YR=? GROUP BY A.COMPANY,A.BRANCH,A.CUSTOMER ) AS LYSALES ON (B.ARNO16=LYSALES.BRANCH AND B.ARNO15=LYSALES.COMPANY AND B.ARNO01 = LYSALES.CUSTOMER) INNER JOIN DS103E.arpmcus c ON (b.arno01=c.arno01) WHERE k.uid = ? ORDER BY CN ASC
Into this diagram: