Mysql查询重复记录

第一步 使用group by 和 having cout 查找重复字段
SELECT t1.`order_book_id` FROM `quant_stock_info` t1 GROUP BY t1.`order_book_id` HAVING COUNT(t1.`order_book_id`)>1 
第二步 使用IN查找
SELECT * FROM `quant_stock_info` t0 
WHERE t0.`order_book_id` 
IN (
	SELECT t1.`order_book_id` FROM `quant_stock_info` t1 
	GROUP BY t1.`order_book_id` HAVING COUNT(t1.`order_book_id`)>1
) 
ORDER BY t0.`order_book_id`
原文地址:https://www.cnblogs.com/ywqbj/p/5809412.html