Re: duplicate values
Posted in 1999
Topics: Performance & Tuning
>However, if you want to eliminate duplicates from a column, I use a stored
>procedure having a FOREACH statement ordered by the specific column, which
>will retrieve each column value and check it against the previous column
>value stored in a variable. If both are same , the current record is
>deleted. I do not know if there is some other optimal way of doing this.
I use
select <distinct columns>, max(rowid) keepit
from table
grou by <disitinct columns>
into temp eric with no log;
delete from table
where rowid not in (select keepit from eric)
Normally locking, long transaction, fragmentation, performance rules apply
Paul Watson
WF Software Ltd
Tel: +44 1436 674729
Fax: +44 1436 678729
www.wfsoftware.com/informix
# If you broke it, hide the evidence
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************