MYSQL

HOW TO GET & COUNT DUPLICATE RECORDS IN MYSQL

ASSUMING ONLY 1 TABLE & COLUMN SELECT `COLUMN`, COUNT(*) AS `rows` FROM `TABLE` GROUP BY `COLUMN` HAVING `rows` > 1

GET DUPLICATE ENTRIES

01

ALL DUPLICATE ENTRIES SELECT * FROM `TABLE`  WHERE `COLUMN` IN (   SELECT `COLUMN` FROM `TABLE`   GROUP BY `COLUMN`   HAVING COUNT(*) > 1 )

GET ALL DUPLICATES

02

ASSUMING TABLE HAS DUPLICATE ROWS WITH DIFFERENT QTY SELECT `COL-NAME`,    SUM(`COL-QTY`) AS `total` FROM `TABLE` GROUP BY `COL-NAME`

COUNT DUPLICATE ENTRIES

03