This is a common question. The syntax looks like this: SELECT a.* FROM tbl_a AS a LEFT JOIN tbl_b AS b ON a.id = b.id WHERE b.id.id IS NULL;
The idea is you're retrieving a recordset of the two tables where the rows are joined on the id. For tbl_b, the id field has no value (its null) so you can identify those rows by asking for nulls in the `tbl_b` `id` column. In your case, I would try: SELECT tbl.* FROM ResourceTable AS tbl LEFT JOIN ResourceLinkTable AS lnk ON tbl.ResourceID= lnk.ResourceID WHERE lnk.ResourceID.id IS NULL ORDER BY ResourceName ASC; Regards, Adam -----Original Message----- From: Dan Lamb [mailto:[EMAIL PROTECTED] Sent: Thursday, October 30, 2003 9:39 AM To: [EMAIL PROTECTED] Subject: select query syntax help Hello All, I have two table the look like this (greatly simplified): ResourceTable ------------- int ResourceID var ResourceName ResourceLinkTable ----------------- int ResourceLinkID int ResourceID var Text I need to find all rows in ResourceTable for which there is NO entry in ResourceLinkTable. I know I could do this with sub-selects like this: Select * from ResourceTable where ResourceID not in (select distinct ResourceID from ResourceLinkTable) How can I do this in MySQL 4.0 without using sub-selects? Thanks, Dan Lamb -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]