SELECT * FROM table1 t1 LEFT OUTER JOIN table2 t2 ON t1.field1=t2.field2
WHERE t2.field2 IS NULL

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of Murad Nayal
> Sent: Monday, December 09, 2002 11:38 AM
> To: MySQL List
> Subject: help on NOT EXISTS SQL query
> 
> 
> 
> 
> Hello all,
> 
> I need to run query like (in mysql < ver.4):
> 
> select * from table1 as t1 where not exists (select NULL from 
> table2 as t2 where t1.field1 = t2.field1)
> 
> I know you can emulate an 'exists' subquery with a join. but 
> I just can't think of a way to emulate a 'not exists' without 
> a subquery. probably due to my limited sql experience. any hints?
> 
> thanks a lot
> Murad
> 
> BTW: when do you think mysql 4.1 would be stable enough for 
> robust use (not necessarily mission critical).
> 
> ---------------------------------------------------------------------
> 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