Dear Henning,

> SELECT Table1.ID FROM Table1 WHERE Table1.ID NOT IN (SELECT Table2.ID
FROM
> Table2);

SELECT Table1.ID FROM Table1 LEFT JOIN Table2 USING (ID) WHERE Table2.ID
IS NULL

Hope it helps,
--
  Stefan Hinz <[EMAIL PROTECTED]>
  Geschäftsführer / CEO iConnect GmbH <http://iConnect.de>
  Heesestr. 6, 12169 Berlin (Germany)
  Tel: +49 30 7970948-0  Fax: +49 30 7970948-3


----- Original Message -----
From: "Henning Sittler" <[EMAIL PROTECTED]>
To: "'mysql users'" <[EMAIL PROTECTED]>
Sent: Tuesday, December 03, 2002 3:16 PM
Subject: MySQL: Select Not In Table


> Just wondering if anyone knows of a work around for selecting rows in
Table1
> that have an ID column value which is not found in the ID column of
Table2.
> I have seen a workaround for selecting similar rows IN both tables,
but I
> want NOT IN.
>
> This would be a work around to the sql subselect query in the
following
> statement:
>
> SELECT Table1.ID FROM Table1 WHERE Table1.ID NOT IN (SELECT Table2.ID
FROM
> Table2);
>
> Thanks for any help!
>
>
>
> ---------------------------------------------------------------------
> 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
>


---------------------------------------------------------------------
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