Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find IDs where all children meet filter
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Find IDs where all children meet filter
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Oracle
Miscellaneous
Thread ID:
00997865
Message ID:
00997865
Views:
44
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
Next
Reply
Map
View

Click here to load this message in the networking platform