Wait. I was finding unmatched detail for a master but you're trying to find functions in the detail that are equal for multiple id.
This should do that.
SELECT * FROM detail LEFT JOIN detailALTVIEW ON detail.function =
detailALTVIEW.function WHERE detail.id != detailALTVIEW.id
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx]On Behalf Of sjl
Sent: Friday, May 29, 2009 10:20 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Locating Primary records with identical detail records
John -
Does this help?
Select * from Detail where Detail.ID in
(Select Master.ID from Master where Master.ID = somevalue)
order by Detail.FUNCTION
This query will show you all detail record were ID = somevalue
ordered by FUNCTION
- sjl
John wrote:
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?
--
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.