At 09:31 16.07.01 +0200, Beatriz Lapaz wrote:
>Hi!!
>
>I'm working with PHP and I use MySQL. I've just known that in MySQL 
>doesn't exist NESTED SELECTS and it's a problem for me.
>I'd need a query to get all the ids from a table which are not in another 
>table. Something like that:
>
>SELECT TABLE.id_field NOT IN (SELECT ANOTHER_TABLE.id_field);
>
>Could you help me? Thanks.

Hi,the problem is, that mysql can not nested selects.
I have make a work around in php.

First I make a list with e.g ids like that ('3','4','5') and then the
SELECT TABLE.id_field NOT IN ('3','4','5')

here the script in php in eine classe eingebaut.

         $da = explode ("-",$datum);
         $q = sprintf ("select lkwangemeldetid from disposition where 
dayofmonth(datumderdisposition) =%d and month(datumderdisposition)=%d and 
year (datumderdisposition)= %d",$da[2],$da[1],$da[0]);
         $this->qdc->query ($q);
         $liste="''";
         while($this->qdc->next_record())
                 {
                 if ($liste == "''")$liste ="";
                 $liste.=sprintf ("'%s',",$this->qdc->f(lkwangemeldetid));
                 }
         if ($liste != "''")
                 $liste=substr($liste,0,-1);
         return $liste;

               BLITZ Internet Service GmbH
                       Kronacher Strasse 41
                     D-96052 Bamberg, Germany
            Tel. +49/951/9685160, Fax +49/951/9685164
                       http://www.blitz.net 

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to