 |
如下方法可以查出库内某字段重复的记录 :
select * from some_dbname
group by code1
having count(*) > 1
tcgslxh的意见:
如果是想选出在code1字段中有重复值的记录哪么:
select * from some_dbname where code1 in (select code1 from some_dbname group by code1 having count(*)>1)
在提问者所给代码中关键是没有将不重复的code1值过滤。
laytau的意见:
select distinct t1.code1 from some_dbname t1 where t1.rowid<(select max(t2.rowid) from some_dbname t2 where t1.code1=t2.code1)
此问题由陆建回答。
附加关键字:编程, 源程序, programming, source code, Delphi, VCL, Borland, SQL查询, sql server, sql, query, select。
|