Re: [GENERAL] SELECT duplicates in a table

2004-11-22 Thread Edward Macnaghten
Assuming identification_number is a unique (primary) key... select * from my_table where date_of_birth in (select date_of_birth from my_table group by date_of_birth having count(*) > 1) Or - it may be quicker to do... select * from my_table a where exists (select 'x' from my_table b where a.da

Re: [GENERAL] SELECT duplicates in a table

2004-11-22 Thread Kall, Bruce A.
Thanks. Worked like a charm! Bruce [EMAIL PROTECTED] wrote: Try SELECT * FROM mytable WHERE (identification_number,date_of_birth) IN (SELECT identification_number , date_of_birth FROM mytable m2 GROUP BY identification_number,data_of_birth

Re: [GENERAL] SELECT duplicates in a table

2004-11-22 Thread vhikida
Try SELECT * FROM mytable WHERE (identification_number,date_of_birth) IN (SELECT identification_number , date_of_birth FROM mytable m2 GROUP BY identification_number,data_of_birth HAVING COUNT(*) > 1 ) There are other ways

[GENERAL] SELECT duplicates in a table

2004-11-22 Thread Kall, Bruce A.
I've look for a solution to this, but have only been able to find solutions to delete duplicate entries in a table by deleting entries not returned by SELECT DISTINCT. What sql should I use to SELECT entries in a table that have two particular column values that match? For example, my_table ha