Subject | Re: [firebird-support] finding duplicates in a table |
---|---|
Author | Lester Caine |
Post date | 2004-08-19T18:53:44Z |
matt_kopf wrote:
GROUP BY FIELD
HAVING COUNT( FIELD ) > 1
index, but use something easier for identifying individual records.
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
> I am trying to set a primary key on a table that is already popluated.SELECT FIELD FROM TABLE
> The table has more than 5000 records in it, and when I set the primary
> key I get an error that says there are duplicate values in the table.
> What I need is a sql statement that will show me what records in the
> table are duplicated. This is what I have come up with so far in my
> testing
GROUP BY FIELD
HAVING COUNT( FIELD ) > 1
> but it returns all the records as well as the duplicate ones. I amFive fields should not be in the primary key. They could be a unique
> very new at SQL so the reason for this is a Mystery to me! The script
> above is just a sample that I was testing with. In the real table
> there are 6 fields and 5 of them are for the new primary key. Any help
> would be great!!!
index, but use something easier for identifying individual records.
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services