Re: Duplicat keys
Posted in 1994
> Date: Mon, 24 Oct 94 09:12:24 EST
> From: sheltra@emh-1.submepp.navy.mil
> To: informix-list@rmy.emory.edu
> Subject: Duplicat keys
>
> I have a problem:
>
> While creating a "unique key index" on a file of about
> 190k records I have incurred a duplicate record. How do I
> find the record(s) with the duplicate key?
>
> We are running Oline 5.0
> 4gl 4.10
> sql 4.10
>
> Thanks in advance for any help.
>
> My e-mail: sheltra@emh-l.submepp.navy.mil
>
You can get the non-unique value(s) by
SELECT key_col
FROM your_table
GROUP BY key_col
HAVING COUNT(*) > 1
Once you have the offending values, you can use rowids or other columns
to select / delete / update the rows with duplicate keys.
Regards,
Alan ___________________________
______________________| R. Alan Popiel |__________________________
\\ Internet: | Martin Marietta, SLS | /
\\ alan@den.mmc.com | P.O. Box 179, M/S 3810 | Std disclaimers apply. /
)Voice: | Denver, CO 80201-0179 USA | (
/ 303-977-9998 |___________________________| (But you knew that!) \\
/________________________) (____________________________\\