if the id doesn't exist in the detail unless there is a function then this would work:
SELECT ID FROM MASTER LEFT JOIN DETAIL ON MASTER.ID = DETAIL.ID
WHERE DETAIL.ID is null
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx]On Behalf Of John McKee
Sent: Friday, May 29, 2009 10:07 AM
To: Midrange Systems Technical Discussion
Subject: Locating Primary records with identical detail records
I have two files, Master and Detail. They share a common key, ID. There can be
any number of Detail records, even zero, for every Master record. The Detail
records have a secondary key sequence, FUNCTION, in ascending order. There are
several instances where the Detail records for one Master record are the same as
the Detail records for another Master record.
In the past, I have tried to locate these by using RPG and building big
variables containing the FUNCTION, then sorting them. Still was a manual
process to examine how closely the records matched.
Can SQL do this?
John McKee
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.