SQL Server 删除重复数据只保留一条
DELETE FROM Bus_TerminalMessage_Keywords WHERE Content IN (select Content from Bus_TerminalMessage_Keywords group by Content having count(Content) > 1) AND ID NOT IN (select min(Id) from Bus_TerminalMessage_Keywords group by Content having count(Content)>1)
第一个条件是找到重复的数据,第二个条件是在重复的数据中保留一条。两个条件取交集就能删除重复数据了