RE: [PHP-ES] duda query mysql

From: Date: Tue, 29 Jun 2004 15:34:29 +0000
Subject: RE: [PHP-ES] duda query mysql
References: 1  Groups: php.general.es 
Request: Send a blank email to general-es+get-49678@lists.php.net to get a copy of this message
Gracias amigo!! -----Original Message----- From: Pablo M. Rivas [mailto:pmrivas01@yahoo.com.ar] Sent: martes, 29 de junio de 2004 12:32 To: 'PHP-ES List' Subject: Re: [PHP-ES] duda query mysql Hello Gonzalo, Select tabla1.campo1 from tabla1 left join tabla2 on tabla2.campo1 = tabla1.campo1 where tabla2.campo1 is NULL group by tabla1.campo1 esta en ingles... pero pegale una mirada: http://dev.mysql.com/doc/mysql/en/JOIN.html dice: "mysql> SELECT table1.* FROM table1 -> LEFT JOIN table2 ON table1.id=table2.id -> WHERE table2.id IS NULL; This example finds all rows in table1 with an id value that is not present in table2 (that is, all rows in table1 with no corresponding row in table2). This assumes that table2.id is declared NOT NULL. See section 7.2.8 How MySQL Optimizes LEFT JOIN and RIGHT JOIN." GG> Hola amigos, se que no es una pregunta para esta lista pero no tengo GG> muchas listas a que recurrir.. GG> Tengo esta query: GG> $sql = "Select distinct(tabla1.campo1) from tabla1 join on GG> (tabla2.campo1 = tabla1.campo1) where tabla1.campo1 NOT IN (select GG> campo1 from tabla2)"; GG> lo que quiero con esta query es tener todos los campo1 de tabla1 que no GG> esten ten campo1 de tabla2 GG> en postgresql esa query me funciona, pero en mysql no. GG> Gracias, GG> Gonzalo -- Best regards, Pablo -- PHP Spanish Localization Talk Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general.es (#49678) next »