Home  >  Article  >  Database  >  mysql-MySQL 删除重复数据(两个字段)

mysql-MySQL 删除重复数据(两个字段)

WBOY
WBOYOriginal
2016-06-06 09:45:011274browse

mysql重复数据数据库

表full中userID和movieID两个字段确定一条唯一的数据。
现在表中有少量重复数据和大量非重复数据。
重复数据中,preference列和timestamp列不为空的这些,需要保留;preference列和timestamp列为空的这些需要删除,应该怎么办?
初学者,希望答案详细:) 感激不尽
+------------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------+------+-----+---------+-------+
| userID | int(11) | NO | | 0 | |
| movieID | int(11) | NO | | 0 | |
| preference | int(11) | YES | | NULL | |
| timestamp | int(11) | YES | | NULL | |
+------------+---------+------+-----+---------+-------+

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn