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

Crea e usa la tabella temporanea nelle query nidificate

with
   ALL_DID as (
      select did from t3
      where price > 500000
   ),
   PAIRS as (
      select
         id, t3.did
      from t1
         left join ALL_DID t3
         on t1.did = t3.did
   )
select id from PAIRS
   group by id
   having count(did) = (
      select count(0) from ALL_DID
   )
minus
select id from PAIRS
   where did is null

violino