Re: simple sql problem
| From: | George Patterson | Date: | Fri, 25 Jul 2003 08:40:16 +0000 |
| Subject: | Re: simple sql problem | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-29470@lists.php.net to get a copy of this message | ||
On Fri, 25 Jul 2003 02:31:39 -0600
Stephen March <steve@enerds.ca> wrote:
> Any database that supports nested queries (unfortunatly this excludes
> MySQL) ... you can do
>
Subselects are supported in MySQL 4.1 ... :-)
> select pic_id from pictures where pic_id not in (select pic_id
> from album_pictures)
>
If you are using a mysql earlier than 4.1, try following equivalent
query...
select pic_id from pictures left join album_pictures on pictures.pic_id=
album_pictures.pic_id;
Nested queries also called subselects are rarely required... Hence Mysql
has not supported them until very recently.
>
> Otherwise you might have a harder time with MySQL ... something like
Harder time?? depends on you background in databases engines.
> set difference if it supports it (I'm not sure what it supports to
> facilitate your need)
> HTH
>