首页 > 解决方案 > MySQL 查询具有多个玩家 ID 的俱乐部名称

问题描述

餐桌俱乐部

我想选择具有多个 player_id 的 club_name。就像 yeshwant 有两个 club_ids 1,2 我只需要选择 yeshwant。我尝试使用此查询,但无法做到

select club_name,count(club_name) as t from club  where count(club_name) >1 group by club_name;

标签: mysqlsql

解决方案


要查找拥有多个玩家的 club_names,您只需要一个简单的聚合:

select club_name
from club
group by club_name
having count(*)>1;

推荐阅读