Re: simple sql problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
> 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux