Re: simple sql problem

From: Date: Fri, 25 Jul 2003 08:31:39 +0000
Subject: Re: simple sql problem
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-29469@lists.php.net to get a copy of this message
Any database that supports nested queries (unfortunatly this excludes MySQL) ... you can do select pic_id from pictures where pic_id not in (select pic_id from album_pictures) Otherwise you might have a harder time with MySQL ... something like set difference if it supports it (I'm not sure what it supports to facilitate your need) HTH ~Steve Merlin wrote:
Hello , I have a sql problem which seems to be simple, but I am kind of stuck, There are 2 tables with IDs. I would like to find out which ID from table one is not in table 2. My statement: SELECT ap. * FROM pictures p , album_pictures ap WHERE ap.pic_id != p.pic_id returns of course all the ids from table pictures which are not in table album_pictures, but I would like to have it the other way arround. Can anybody help on this. Thanx a lot in advance for any help, Merlin


« previous php.db (#29469) next »