在表中,有的字段不是主键也不具备唯一性,但是在使用过程中,该字段不应用重复,有的时候它偏偏重复了。所以,为了找出某个重复字段的行,使用一下SQL语句:
--即有: --Select * From 表 Where 重复字段 In (Select 重复字段 From 表 Group By 重复字段 Having Count(*)>1) --来一个具体的例子 select * from t_exterm where mainkeyindex in (select mainkeyindex from t_exterm Group By mainkeyindex Having Count(*)>1)
原文:http://my.oschina.net/u/2245029/blog/523946