查询一张表中有重复字段的记录

mac2022-06-30  23

语法: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);

 

转载于:https://www.cnblogs.com/D-Chen/p/5615308.html

最新回复(0)