RE: [PHP-DB] SQL query

From: Date: Mon, 12 Nov 2001 10:22:40 +0000
Subject: RE: [PHP-DB] SQL query
Groups: php.db 
Request: Send a blank email to php-db+get-14248@lists.php.net to get a copy of this message
> Thanks but I think subselect is not possible with MYSQL. You're right. Here's a MySQL compatible alternative: SELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id where table2.id IS NULL From the MySQL manual on sub-selects at: http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html -----Original Message----- From: Pierre Sent: Mon 11/12/2001 12:20 AM To: Gonzalez, Lorenzo; php-db@lists.php.net Cc: Subject: Re: [PHP-DB] SQL query Thanks but I think subselect is not possible with MYSQL. Pierre ----- Original Message ----- From: Gonzalez, Lorenzo <gonzalez@gltg.com> To: Pierre <p.marcandella@justtransfer.com>; <php-db@lists.php.net> Sent: Monday, November 12, 2001 1:08 PM Subject: RE: [PHP-DB] SQL query > in other RDBMs this is easily done with a subselect - don't know if it's > doable in MySQL or not, someone else can confirm, or you can try it > yourself... > > select * from table1 where table1.id not in (select table2.id); > > -Lorenzo > > -----Original Message----- > From: Pierre > Sent: Sun 11/11/2001 10:01 PM > To: php-db@lists.php.net > Cc: > Subject: [PHP-DB] SQL query > > > > I have two tables, one call category, the other chapter > > Category table > [id][name] > [1][a] > [2][b] > [3][c] > [4][d] > > Chapter table > [id][FK_name] > [1][a] > [2][a] > [3][c] > > > I would like to get the list of names of the Category table that > are NOT present in the Chapter table. > On this example, I should find "b" and "d". > > Is it possible to get it directly from a SQL query ? (I am using > MYSQL). > > Thank for helping me. > > Pierre > > >

« previous php.db (#14248) next »