|
Thanks for your reply Joe
I must admit, this one took a LOOOONG time to sink in, but once it did -------NNNNNIIIIICCCCCEEEE
Like I said previously, once I got this piece worked out, I still have a lot more to do, but without this problem being solved, it would be REALLY difficult to move forward
Thanks
Alan Shore
Programmer/Analyst, Direct Response
E:AShore@xxxxxxxx
P:(631) 200-5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Joe Pluta
Sent: Thursday, July 21, 2011 6:11 PM
To: Midrange Systems Technical Discussion
Subject: Re: Using SQL to group records with similar elements
Alan, are you trying to find matches for only one record (the first) or are you trying a more comprehensive test of finding any records that match any other records? The reason I ask is that it can be even
simpler. If one record is your master record, it becomes very easy (in
this case, the one record is the one with a key of 00001:
// Create a temporary table of all target values
// Select from SYSDUMMY1 makes sure there is a blank in the table
with t1 as (
select field1 as value from Example where key = '00001' union
select field2 as value from Example where key = '00001' union
...
select field21 as value from Example where key = '00001' union
select ' ' as value from sysibm/sysdummy1
)
// Select records where every value is in the target value list SELECT * FROM Example WHERE
field1 in (select value from t1) and
field2 in (select value from t1) and
...
field21 in (select value from t1)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.