MySQL - Como Haria con Esto? NOT IN

 
Vista:

Como Haria con Esto? NOT IN

Publicado por David (8 intervenciones) el 14/04/2003 18:21:52
Saludos desde Peru. Este es mi problema quiero obtener los registros de una tabla(tabla auto) que no existan en otra tabla (tabla detalle), probe con esta consulta:

Select * from auto where auto.cod_auto not in (select detalle.cod_auto from detalle);

pero no funciona quiero saber como haria esto con otra sintaxis de mysql, espero que me puedan ayudar gracias .
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Como Haria con Esto? NOT IN

Publicado por Fernando (8 intervenciones) el 15/04/2003 19:19:14
Te paso un tramo del manual oficial

expr IN (value,...)
Returns 1 if expr is any of the values in the IN list, else returns 0. If all values are constants, then all values are evaluated according to the type of expr and sorted. The search for the item is then done using a binary search. This means IN is very quick if the IN value list consists entirely of constants. If expr is a case-sensitive string expression, the string comparison is performed in case-sensitive fashion:
mysql> select 2 IN (0,3,5,'wefwf');
-> 0
mysql> select 'wefwf' IN (0,3,5,'wefwf');
-> 1

expr NOT IN (value,...)
Same as NOT (expr IN (value,...)).

Espero que te sirva
Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar