× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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


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-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.