mysql data deduplication

There are multiple pieces of the same data in the mysql table, deduplication method.

MySQL delete has the following syntax notes:

1. Limit is not supported

2. Subqueries are not supported

 

SELECT * FROM bank_info c
WHERE id IN
(
	SELECT * FROM
	(
		SELECT id FROM bank_info a  
		WHERE
		(
			a.bank_num IN (SELECT bank_num FROM bank_info GROUP BY bank_num HAVING COUNT(*) > 1)
			AND
			a.create_time NOT IN (SELECT MIN(create_time) FROM bank_info GROUP BY bank_num HAVING COUNT(*) > 1)
		)
	) e
)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326440655&siteId=291194637