Beispiel:
SELECT
D.DEAL_NUMBER,
D.D_TYPE,
ACD.ACC_NUMBER,
DP.DEPARTMENT_NUMBER
FROM
DEALS D
join DEPARTMENT DP
on D.DEP_NUMBER = DP.DEP_NUMBER
left join ACCOUNT_DETAILS ACD
on ACD.DEAL_NUMBER = D.DEAL_NUMBER
join ACCOUNT AC AC.ACC_NUMBER = ACD.ACC_NUMBER
WHERE DEAL_TYPE = 'XXXX'
AND ACD.DEAL_NUMBER = D.DEAL_NUMBER