Thanks for your reply Jorge
It looks like Chuck was right, that my explanation wasn't definitive enough
I don't want to change the key, I just want to extract the records that contain some combination of the same values as in the record of Key 00001
In my example, the resultant extract would be
Key field1 field2 field3 field4 field5 field6 field7 etc.-->
00002 160
00004 160 118
00005 202
00006 400
Because these records contain the values in field1 through field etc. as was contained in Key 00001
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 Jorge Merino
Sent: Thursday, July 21, 2011 2:08 PM
To: Midrange Systems Technical Discussion
Subject: RE: Using SQL to group records with similar elements
SELECT distinct case KEY when '00002' THEN '00001'
when '00004' THEN '00001'
when '00005' THEN '00001'
when '00006' THEN '00001'
else KEY
end AS New_Key
from apvendp
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Shore
Sent: Thursday, July 21, 2011 10:38 AM
To: 'midrange-l@xxxxxxxxxxxx'
Subject: Using SQL to group records with similar elements
Good afternoon all
I'm not too sure if the subject line truly describes my predicament, so here goes I've been working on this for the past couple of days without success, so I am hoping someone has an answer to my problem I have a file that contains (among other things) 21 occurrences of the same size field that can contain similar data For example
Key field1 field2 field3 field4 field5 field6 field7 etc.-->
00001 360 160 202 400 118
00002 160
00003 400 202 600
00004 160 118
00005 202
00006 400
00007 111
Using record key 00001 as a starting point, I need to group all records that have any of the non- blank values in any of the occurrences, EXCLUDING those records that have OTHER none blank values Using the above example Keys 00002, 00004, 00005, 00006 would be grouped with 00001 Key 00003 would not (value 600 NOT in Key 00001) Key 00007 would not (value 111 NOT in Key 00001)
Hopefully, what I am asking makes sense, AND is feasible As always, any and all suggestions are welcome
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
--
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.
--
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.