Forum Moderators: open

Message Too Old, No Replies

Finding Duplicate record

         

sfast

3:12 pm on Mar 13, 2008 (gmt 0)

10+ Year Member



I have 7000 records in a table. There is a id_number field which is of type int. I want it to be primary key. But out of 7000 records there is one duplicate record.

When I do distinct id_number from table

it gives me total of 6999 records.

Can somebody guide me how to write the query to find out that one duplicate record.

mark_roach

3:57 pm on Mar 13, 2008 (gmt 0)

10+ Year Member



select id_number, count(*) from table
group by id_number
having count(*) > 1

sfast

4:36 pm on Mar 13, 2008 (gmt 0)

10+ Year Member



Thanks. The query worked.