Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Versuch, eine MINUS-Operation in MySQL durchzuführen

MySQL erkennt MINUS nicht und SCHNEIDEN , dies sind Oracle-basierte Operationen. In MySql kann ein Benutzer NOT IN verwenden als MINUS (andere Lösungen gibt es auch, aber mir hat es sehr gut gefallen ).Beispiel:

select a.id 
from table1 as a 
where <condition> 
AND a.id NOT IN (select b.id 
                 from table2 as b 
                 where <condition>);