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



I assume you have the SQL licensed product - then you also have Query Manager. 
Run the STRQM command, take option 1, if "Query creation mode" says Prompt, 
press F19 to set it to SQL. Change the library if you want. Put a 1 in the opt 
column and put in a name, say MYQRY. Press enter.

Put the following statement into the editor:

select distinct * from mylib/myfile

At this point you don't even have to create the QMQRY - you can test it using 
F5. The first time, choose display (1) for output, to see that the result is 
what you want. Then exit and do F5 again - this time choose file (3) for output 
- you will get a prompt for the output file. Put in the same name as the one in 
the select statement - mylib/myfile.

This will replace the contents of mylib/myfile with the result of the SELECT 
statement - in place - with no warning. This is dangerous - always make a 
backup first. Or verify as suggested above.

If you do not have the STRQM command, you can CRTSRCPF yourlib/QQMQRYSRC 
rcdlen(91), add a member, put the above statement into it, execute the CRTQMQRY 
command against that source member, use STRQMQRY source to run the statement 
and choose the output type you want - similar to above.

HTH
Vern
-------------- Original message -------------- 
From: "Jim Essinger" <dilbernator@xxxxxxxxx> 

Greetings! 

I have a file that, among other fields, has Account_Number, Date, Sequence 
number. 

In the file there are multiple occurrences of those three fields. Example 

Account_Number Date Sequence_number 
1 20061206 01 
1 20061206 01 
1 20061206 01 
1 20061206 02 
1 20061206 02 
1 20061206 02 
1 20061206 03 
1 20061206 03 
1 20061206 03 
1 20061206 04 
1 20061206 04 
1 20061206 04 

What I am looking for is a way to delete all but one occurrence of the 
repeated data to get a file that looks like; 

Account_Number Date Sequence_number 
1 20061206 01 
1 20061206 02 
1 20061206 03 
1 20061206 04 


Is this something I can do with SQL? If so, what would the SQL statement 
look like? 


Jim 

-- 
Jim Essinger 
Senior Programmer/Analyst 
SLFIMA 
PO Box 1000 
Fruitland, ID 83619 
208-452-4058 x133 
-- 
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.

This thread ...

Follow-Ups:

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.