Oracle
 sql >> Database >  >> RDS >> Oracle

come selezionare il valore dal risultato della sottoquery

Esempio:

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