我需要在 MySQL
表上DELETE
指定 sid 的重复行.
I need to DELETE
duplicated rows for specified sid on a MySQL
table.
如何使用 SQL 查询执行此操作?
How can I do this with an SQL query?
DELETE (DUPLICATED TITLES) FROM table WHERE SID = "1"
类似这样的事情,但我不知道该怎么做.
Something like this, but I don't know how to do it.
这会在原地删除重复项,而无需创建新表
this removes duplicates in place, without making a new table
ALTER IGNORE TABLE `table_name` ADD UNIQUE (title, SID)
注意:只有当索引适合内存时才有效
note: only works well if index fits in memory
这篇关于如何删除 MySQL 表上的重复项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!