參考網址:iT邦幫忙 MySQL: 子查詢
select gov_code,count(player_id) as cc from (select gov_code,player_id from game group by player_id) abc group by gov_code
player可以參加多項比賽。()內的子查詢先把 player_id group 起來變成只有一筆資料,記得()之後便給個名字,讓它變成一個table。
參考網址:iT邦幫忙 MySQL: 子查詢
select gov_code,count(player_id) as cc from (select gov_code,player_id from game group by player_id) abc group by gov_code
player可以參加多項比賽。()內的子查詢先把 player_id group 起來變成只有一筆資料,記得()之後便給個名字,讓它變成一個table。