你的位置:首页 > 数据库

[数据库]查询一张表中有重复字段的记录


语法:select * from 表名 where (字段名) in  (select 字段,名 from 表名 group by 字段名 having count(*) > 1);

如一下goods表:

执行sql语句:select * from  goods where inventory in (select inventory from goods group by inventory having count(*) > 1);