Oracle
 sql >> Datenbank >  >> RDS >> Oracle

Erstellen und verwenden Sie temporäre Tabellen in verschachtelten Abfragen

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

Geige