sql >> Base de Datos >  >> RDS >> Mysql

Intentando realizar la operación MENOS en MySQL

MySql no reconoce MINUS y INTERSECCIÓN , estas son operaciones basadas en Oracle. En MySql, un usuario puede usar NOT IN como MINUS (también hay otras soluciones, pero me gustó mucho ).Ejemplo:

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