Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find IDs where all children meet filter
Message
De
21/03/2005 14:03:47
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Oracle
Divers
Thread ID:
00997865
Message ID:
00997916
Vues:
10
>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)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform