maybe a sub query? SELECT field1 FROM table1 WHERE field1 NOT IN (SELECT field1 FROM table2)
something like that.. not sure of the syntax. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Darren Tracey Sent: Wednesday, 4 May 2005 5:39 AM To: CFAussie Mailing List Subject: [cfaussie] SQL question I'm trying to do something in SQL (MSSQL7) and my brain is all fuzzy and I can't think how to do it. I've got 2 tables (table1, table2). table1 has an id field (idfield1), a bunch of other fields and has numerous records in it. table2 has a field called idfield1 that contains an id from entries in table1. Multiple table2 records can have the same table1 id value in this field. All table1 entries 'should' have one or more records in table2 with their id value, yet for various historical reasons, there may be table1 entries with no corresponding table2 entries. What SQL can I use to get a set of records back that are all the table1 records that _don't_ have their id field in any table2 records? Regards Darren Tracey --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ --- You are currently subscribed to cfaussie as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
