概述
查询名字重复的数据
select * from user where username in (select username from user group by username having count(username)>1)
根据多个字段查询表中这些字段相同的数据
select * from user
where id in (select id from user GROUP BY id,name having count(1)>1)
and name in (select name from user GROUP BY
id,name having having count(1)>1)
ORDER BY id,name
查询按姓名分组取最大值
select id,username,max(created_date) as created_date from user group by username having count(id)>1
最后
以上就是爱笑时光为你收集整理的msyql查询多条数据sql的全部内容,希望文章能够帮你解决msyql查询多条数据sql所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复