Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find IDs where all children meet filter
Message
From
21/03/2005 14:03:47
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Oracle
Miscellaneous
Thread ID:
00997865
Message ID:
00997916
Views:
12
>Brilliant! That works perfectly. I thought of trying the EXISTS clause, but I just can not grasp the concept of how it works. I have studied it, but my mind just can not comprehend that particular nuance of the SQL language. Thanks!
>
>>Mark,
>>
>>Try
select distinct log_id from hlp_main_items hmt1
>>	where NOT EXISTS
>>		(SELECT * FROM Hlp_Main_Items hmt2
>>			WHERE hmt2.log_id = hmt1.log_id AND hmt2.Completed IS NULL)
>>
BTW, it seems to me that your query should work also.
>
>Logically, I thought it should as well, but I was tired of fighting that battle. I gotta move on.

Mark,
if one child record exists surely, then scan parent table is sufficient,
and it return distinct for definition:
select log_id from hlp_main hmt1
   where NOT EXISTS(SELECT * FROM Hlp_Main_Items WHERE log_id = hmt1.log_id AND Completed IS NULL)
Previous
Reply
Map
View

Click here to load this message in the networking platform