标签: mysql
我有一个包含3个字段的表,例如
名称,团队名称,Player_Number
有多个团队,我想从每个团队中获取2个成员。
请与快速解决方案分享。
答案 0 :(得分:0)
试试这个
select * from TableName s where (select count(*) from TableName a where a.TeamName = s.TeamName and a.Player_Number >= s.Player_Number) <= 2