sql 查询表字段相同的数据

xiaoxiao2021-02-27  419

sql语句查询一张表中,同一个字段相同的值:

sql: 

select * from user where user_name in

(select user_name ss from user group by user_name having count(*)> 1)

得到结果是:

ID             name    

1 马先生

2 马先生

3 丽丽

4 丽丽

马先生

..........

转载请注明原文地址: https://www.6miu.com/read-4344.html

最新回复(0)