mysql查询某字段相同的记录

mysql查询某字段相同的记录,第1张

select * from 表名 where match_id in (select match_id from 表名 where team_id='a' or team_id='b' group by match_id)

可以通过用该字段分组计数获得。例如:

select col1,count(col1) as cnt

from t1 group by col1

这个查询可返回表t1的字段col1中每个值的重复次数

select * from (select * from a union all select * from b) T where name in (select name from a  where name in( select name from b))

已经经过测试。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/8665630.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-19
下一篇 2023-04-19

发表评论

登录后才能评论

评论列表(0条)

保存