我正在尝试从 MySQL 表中删除双联(有时是三联,不幸的是!)。我的问题是唯一可用的唯一数据是主键,所以为了识别双峰,你必须考虑所有的列。
我已经设法识别出所有具有双线的记录,并将它们连同它们的双线(包括它们的主键)复制到表中temp
。源表被调用translation
,它有一个名为 的整数主键TranslationID
。我该如何从这里继续前进?谢谢!
编辑可用的列是:
TranslationID
LanguageID
Translation
Etymology
Type
Source
Comments
WordID
Latest
DateCreated
AuthorID
Gender
Phonetic
NamespaceID
Index
EnforcedOwner
Latest
重复问题在于分配了列的行1
。
编辑#2谢谢大家的时间!我已经通过使用WouterH的答案解决了这个问题,导致以下查询:
DELETE from translation USING translation, translation as translationTemp
WHERE translation.Latest = 1
AND (NOT translation.TranslationID = translationTemp.TranslationID)
AND (translation.LanguageID = translationTemp.LanguageID)
AND (translation.Translation = translationTemp.Translation)
AND (translation.Etymology = translationTemp.Etymology)
AND (translation.Type = translationTemp.Type)
AND (translation.Source = translationTemp.Source)
AND (translation.Comments = translationTemp.Comments)
AND (translation.WordID = translationTemp.WordID)
AND (translation.Latest = translationTemp.Latest)
AND (translation.AuthorID = translationTemp.AuthorID)
AND (translation.NamespaceID = translationTemp.NamespaceID)