I believe you are after LEFT OUTER JOIN, if I am understanding you 
correctly. 

e.g.

FROM table1 LEFT OUTER JOIN table2 ON table1.idfiedl1 = table2.idfield2

If you mean litterally getting all records in table1 that DO NOT have any 
records in table2, then off the top of my head:

SELECT
        *
FROM
        table1
WHERE
        table1.idfield1 NOT IN (        SELECT
                                        idfield1
                                FROM
                                        table2
                                )


Darryl 
http://dangermoose.blogspot.com

[EMAIL PROTECTED] wrote on 04/05/2005 05:38:31 AM:

> 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/



To unsubscribe from this email please forward this email to [EMAIL PROTECTED] 

This email message is confidential and may be privileged. Unauthorised use, 
copying or distribution of any part of this email
including attachments is prohibited.  If you are not the intended recipient 
please forward the email to [EMAIL PROTECTED]
and delete the original. 

ABN AMRO Morgans Limited and its associates hold or may hold securities in the 
companies/trusts mentioned herein.  Any general
advice included in this email has been prepared without taking into account 
your objectives, financial situation or needs.  Before
acting on the advice, you should consider its appropriateness or discuss with 
one of our investment advisors.

To the extent permitted by law we exclude (and where the law does not permit an 
exclusion, limit to the extent permitted by law) all
liability for any direct, indirect and consequential costs, losses, damages and 
expenses incurred in any way (including but not limited
to that arising from negligence), connected with any use or access to this 
email or any reliance on information contained in this email
or any attachments.

ABN AMRO Morgans Limited (ABN 49 010 669 726 AFSL 235410) A Participant of ASX 
Group  A Principal Member of the
Financial Planning Association


---
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/

Reply via email to