当前位置: 代码迷 >> Sql Server >> 这条语句有什么东东啊
  详细解决方案

这条语句有什么东东啊

热度:59   发布时间:2016-04-27 13:18:12.0
这条语句有什么错误啊?
我是删除数据库里 有某些字段相同的记录只保留一个,这样怎么做?
SQL code
DELETE FROM aFROM         TollData AS a CROSS JOIN                      aWHERE     EXISTS                          (SELECT     1 AS Expr1                            FROM          TollData                            WHERE      (CardID = a.CardID) AND (StCardDate = a.starddate) AND (Balance = a.Balance))


------解决方案--------------------
SQL code
delete from a where id not in (select max(id) from a group by CardID,StCardDate ,Balance )
  相关解决方案