Re: duplicate values
Posted in 1999
For a simple listing of duplicates within a column, you can select the column and group by the column. SELECT <col1> FROM <tab1> GROUP BY <col1> For a count of duplicates you can use SELECT <col1> , count(<col1>) FROM <tab1> GROUP BY <col1> 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. ----- Original Message ----- From: Phillip Tien <phillip.tien@wholefoods.com> To: <informix-list@iiug.org> Sent: Thursday, September 23, 1999 7:36 AM Subject: duplicate values > Anybody got a handy sql statement to find duplicate values within a > column?? > > -- > Phillip Tien > > If you ever reach total enlightenment while drinking beer, I bet you > could shoot beer out of you nose. >