Select * from employees left outer join dept on employees.emp_DepId = dept.dep_id where dept.dep_id is null
(Subselect would be easier if MySQL supported it!) HTH, =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -----Original Message----- From: Silmara [mailto:[EMAIL PROTECTED]] Sent: Monday, December 02, 2002 12:34 PM To: [EMAIL PROTECTED] Subject: NOT IN How can I query all records that not matching in another table? Ex. Select * from employees where emp_DepId not in (select dep_id from dept) Silmara MySQL --------------------------------------------------------------------- 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