Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Instrução SQL - SELECIONE o inverso desta consulta


Basta usar esta consulta:
SELECT * 
     FROM Guide where id NOT IN (
       SELECT Guide.id 
         FROM Guide
         INNER JOIN GuideAvailability ON Guide.id = GuideAvailability.guideId
         WHERE GuideAvailability.startDate IN (1377946800) 
         GROUP BY GuideAvailability.guideId 
         HAVING COUNT(DISTINCT GuideAvailability.id) = 1
      )