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



Thanks for the suggestion but the distinct still did not work.


Bill



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Rettig, Roger
Sent: Monday, July 22, 2013 10:16 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: SQL Update duplicate records

Have you tried putting a distinct in your sub-select?

UPDATE MYFILE B SET B.DATE = '2013-07-18'
WHERE
B.PALLET IN ( SELECT *DISTINCT *B.PALLET
From MYFILE B, MYFILE C
Where B.PALLET = C.PALLET and RRN(B) > RRN(C)
AND B.DATE = '2013-07-19'
AND C.DATE = '2013-07-19')


On Mon, Jul 22, 2013 at 9:31 AM, Milyard, William A. <
William_Milyard@xxxxxxxxxxxx> wrote:



I know I've seen this in the archives but I can't find the solution. I
need to update one field where the entire row is a duplicate. For example:

Pallet Date
915 2013-07-17
915 2013-07-19 Need to change to 2013-07-18
915 2013-07-19
918 2013-07-19
920 2013-07-19 Need to change to 2013-07-18
920 2013-07-19


UPDATE MYFILE B SET B.DATE = '2013-07-18'
WHERE
B.PALLET IN ( SELECT B.PALLET
From MYFILE B, MYFILE C
Where B.PALLET = C.PALLET and RRN(B) > RRN(C)
AND B.DATE = '2013-07-19'
AND C.DATE = '2013-07-19')


I've tried several variations of this statement but it always updates too
many records. I know there other ways to fix this problem but I have 9
files with hundreds of records so SQL seems to be the best solution.
Any help is appreciated.

Thanks, Bill






________________________________
Notice from Bob Evans Farms: This e-mail message, including any
attachments, may contain confidential information that is intended only for
the person or entity to which it is addressed. Any unauthorized review,
use, disclosure or distribution is strictly prohibited. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies of the original message and any attachments.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




--
Roger Rettig
Business Analyst
Cincinnati Incorporated
Tel: (513) 367-7583
roger.rettig@xxxxxxxx
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

________________________________

Notice from Bob Evans Farms: This e-mail message, including any attachments, may contain confidential information that is intended only for the person or entity to which it is addressed. Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and any attachments.

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.