I believe the following query will do what you want it to do:

SELECT t1.id from table1 as t1 LEFT JOIN table2 as t2 on t2.t1id = t1.id 
AND t2.id = 9 WHERE t2.id IS NULL;

More information can be found at 
http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html about sub-select 
work arounds.
Hope that helps some.

Harrison

Jesper Öman wrote:

>Hi, I have a little problem making a query with only one SELECT phrase;
>
>I wan't to solve this with a JOIN since sub-selects are not supported in
>MySQL:
>
>select table1.id from table1 where table1.id not in(select table2.t1id
>from table2 where table2.id = 9)
>
>I can't imagine this not being possible in any other way.
>
>       /Jesper Öman, Sweden
>
>
>---------------------------------------------------------------------
>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