Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find child records not in parent table
Message
From
09/03/2011 15:08:35
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01503028
Message ID:
01503077
Views:
25
Looks like I was in too big of a hurry and misted the !=. Sorry about that.

>It should be '='
>
>select * from ChildTable where not exists (select 1 from ParentTable where ChildTable.fielda = ParentTable.fielda) 
>
>
>>Thank you very much.
>>
>>>select * from ChildTable where not exists (select 1 from ParentTable where ChildTable.fielda != ParentTable.fielda)
>>>
>>>>I must be missing something very simple. I am trying to find records in the child table that have no corresponding records in the parent table. Here is what I do:
>>>>
>>>>
>>>>select * from ChildTable join ParentTable where ChildTable.fielda != ParentTable.fielda
>>>>
>>>>
>>>>But it does not work. TIA.
Previous
Reply
Map
View

Click here to load this message in the networking platform