Do an exception join on the detail file
This will list all the detail records that do NOT have an order number in the header file

Select a.* from ORDDETAIL a exception join ORDHEADER b on
a. ODOHNO = b. OHOHNO





This is the OPPOSITE of a join which will give you all the detail records that have an order number in the header
Select a.* from ORDDETAIL a join ORDHEADER b on
a. ODOHNO = b. OHOHNO
Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of James H. H. Lampert
Sent: Tuesday, November 26, 2019 2:22 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: [EXTERNAL] Quick SQL question

Ladies and Gentlemen:

Given a header table H, and a detail table D, tied together with an "order number" field that is OHOHNO in H, and ODOHNO in D, is there an SQL syntax that would produce a list of "orphaned" details that have no header?

--
JHHL

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.