|
That solution looks appealing but I think it'll generate duplicate rrns in some cases and possibly cause problems for the delete. Try this alteration: DELETE FROM myLib/myFile d WHERE RRN(d) IN (SELECT RRN(b) FROM myLib/myFile b, (SELECT a.f1, MIN(RRN(a)) minrrn FROM myLib/myFile a GROUP BY a.LastName) AS c WHERE b.LastName = c.LastName AND RRN(b) > c.minrrn) Elvis -----Original Message----- Subject: RE: Delete Duplicate Rows That's interesting...the first SQL statement (the SELECT) shows a bunch of dup rows, the second SQL statement (the DELETE) says no rows found. > -------- Original Message -------- > Subject: Re: Delete Duplicate Rows > From: rob@xxxxxxxxx > Date: Wed, September 14, 2005 12:33 pm > To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx> > > http://tinyurl.com/b86rz > http://www.as400network.com/artarchive/index.cfm?fuseaction=viewarticle&CO_C ontentID=14940&channel=art&subart=top&topicid=51 > > Rob Berendt > -- > Group Dekko Services, LLC > Dept 01.073 > PO Box 2000 > Dock 108 > 6928N 400E > Kendallville, IN 46755 > http://www.dekko.com > > > > > > michael@xxxxxxxxxxxxxxxxxx > Sent by: midrange-l-bounces@xxxxxxxxxxxx > 09/14/2005 11:20 AM > Please respond to > Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx> > > > To > midrange-l <midrange-l@xxxxxxxxxxxx> > cc > > Subject > Delete Duplicate Rows > > > > > > > How can I delete duplicate rows in Interactive SQL? I know how to find > them...I don't know how to delete all the dups and just leave one row > in a group. > > TIA..
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.