Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find IDs where all children meet filter
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Find IDs where all children meet filter
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Oracle
Divers
Thread ID:
00997865
Message ID:
00997865
Vues:
43
I have a child table with multiple records for each parent record. My definition of a Help Desk call that is NOT completed means there is at least 1 child record whose "Completed" date is NULL. That is simple enough. So I have created a view for that condition which does return expected results:
create or replace view Incomplete_Calls as
select distinct log_id from hlp_main_items
where completed is null
The "Log_ID" is the foreign key reference to the PK in the parent table.

What I need now that is not working is a list of IDs for completed calls. This should be easy right? Just select the IDs that are not in the "Incomplete_Calls" view. However, I am getting NO IDs returned in the cursor and no error message. The following syntax is what I am using, and would appreciate any insight where I am going wrong. Alternative means of doing this with a single or multiple other SQL is fine as well. TIA!
select distinct log_id from hlp_main_items
where log_id not in
(select log_id from incomplete_calls)
Keep in mind that I have tried single SQL to do this, like:
select distinct log_id from hlp_main_items where
log_id NOT IN
(SELECT DISTINCT Log_ID FROM Hlp_Main_Items WHERE Completed IS NULL)
Mark McCasland
Midlothian, TX USA
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform