I have a table with a varchar column, and I would like to find all the records that have duplicate values in this column. What is the best query I can use to find the duplicates?
相关问题
- sqlyog export query result as csv
- NOT DISTINCT query in mySQL
- MySQL: conduct a basic search
- Why sometimes there is one of more gap(s) in the v
- mySQL alter table on update, current timestamp
Assuming your table is named TableABC and the column which you want is Col and the primary key to T1 is Key.
The advantage of this approach over the above answer is it gives the Key.
The following will find all product_id that are used more than once. You only get a single record for each product_id.
Code taken from : http://chandreshrana.blogspot.in/2014/12/find-duplicate-records-based-on-any.html
To find how many records are duplicates in name column in Employee, the query below is helpful;
Replace city with your Table. Replace name with your field name