#查询重复数据
SELECT id ,col1,col2 FROM tab1 GROUP BY col1 , col2 HAVING COUNT(*)>1
#查询所有重复数据
SELECT * FROM tab1 a WHERE (a.col1,a.col2 ) IN ( SELECT col1,col2 FROM tab1 GROUP BY col1,col2 HAVING COUNT(*)>1)
#删除重复数据
DELETE FROM tab1 WHERE id NOT IN ( SELECT temp.mid FROM ( SELECT min(id) as mid FROM tab1 em GROUP BY em.col1,em.col2) AS temp);