MySQL: Find Duplicate Entry / Rows / Records
A quick tip – I kind of have the feeling that I’ve covered this before, but whatever – well, just the simple SQL query below will do:
CREATE TABLE temp SELECT id, COUNT(id) FROM `book` GROUP BY isbn, subject HAVING COUNT(id) > 1
Wherein each combination of column isbn and column subject in each of the rows from table book should be unique and you want to find out those duplicate ones. You can simply select without creating a temporary table to store the duplicates, but this would come handy when the book table has like 1 million records.
0 comments:
Post a Comment