第一步 使用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`
posted on 2016-08-26 10:37  yanweiqi  阅读(4539)  评论(0编辑  收藏  举报