を制限を追加します。 creator
タグを見ると、それはKr
の領域しかないので、私はそれを取り除きたいです。 Am
領域しか持たないので、PartinG
と同じことです。は、私は、このSQLクエリを持つSQLクエリに
+-------------+-----------+--------+
| tag | game_race | region |
+-------------+-----------+--------+
| Leenock | Z | AM |
| Leenock | Z | EU |
| Leenock | Z | AM |
| Leenock | Z | AM |
| Leenock | Z | EU |
| Leenock | Z | KR |
| Creator | P | KR |
| Creator | P | KR |
| Life | Z | AM |
| Life | Z | EU |
| Life | Z | KR |
| Life | Z | KR |
| Life | Z | AM |
| Life | Z | KR |
| Life | Z | KR |
| Life | Z | EU |
| Life | Z | EU |
| DongRaeGu | Z | KR |
| DongRaeGu | Z | KR |
| DongRaeGu | Z | KR |
| DongRaeGu | Z | KR |
| DongRaeGu | Z | EU |
| DongRaeGu | Z | AM |
| DongRaeGu | Z | AM |
| DongRaeGu | Z | AM |
| PartinG | P | AM |
| TaeJa | T | KR |
| TaeJa | T | EU |
| TaeJa | T | AM |
| TaeJa | T | KR |
| TaeJa | T | EU |
| TaeJa | T | KR |
| TaeJa | T | EU |
| TaeJa | T | KR |
| TaeJa | T | EU |
| TaeJa | T | KR |
| TaeJa | T | EU |
| TaeJa | T | KR |
| TaeJa | T | KR |
| TaeJa | T | KR |
| TaeJa | T | KR |
| TaeJa | T | KR |
これはうまくいくと思っていましたが、重複が発生しました。
SELECT players.player_id, players.tag, players.game_race,
earnings.tournament, earnings.player, earnings.position,
tournaments.tournament_id, tournaments.region
FROM players
JOIN earnings ON players.player_id = earnings.player
JOIN (SELECT player FROM earnings
where position = 1 group by player having count(player) > 2)
as DupPlayer on earnings.player=DupPlayer.player
JOIN (SELECT region FROM tournaments
group by region having count(region) > 2)
as DupPlayer1 on region=DupPlayer1.region
JOIN tournaments ON earnings.tournament = tournaments.tournament_id
where earnings.position = 1 and tournaments.region is not NULL
ORDER BY players.player_id;
の提案をしようとしています。これは動作していないようです。それはPartingを後に残し、SjoWはすべてEUを持っています。
> SELECT players.tag, players.game_race, tournaments.region
-> FROM players
-> JOIN earnings ON players.player_id = earnings.player
-> JOIN (SELECT player FROM earnings
-> where position = 1 group by player having count(player) > 2)
-> as DupPlayer on earnings.player=DupPlayer.player
-> JOIN tournaments ON earnings.tournament = tournaments.tournament_id
-> and tournaments.region in ('AM', 'EU', 'KR')
-> where earnings.position = 1 and tournaments.region is not NULL
-> and players.tag in (
-> SELECT players.tag
-> FROM players
-> JOIN earnings ON players.player_id = earnings.player
-> JOIN (SELECT player FROM earnings
-> where position = 1 group by player having count(player) > 2)
-> as DupPlayer on earnings.player=DupPlayer.player
-> JOIN tournaments ON earnings.tournament = tournaments.tournament_id
-> and tournaments.region in ('AM', 'EU', 'KR')
-> group by players.tag
-> having count(distinct tournaments.region) = 3
->)
-> ORDER BY players.player_id;
+------------+-----------+--------+
| tag | game_race | region |
+------------+-----------+--------+
| Leenock | Z | AM |
| Leenock | Z | AM |
| Leenock | Z | AM |
| Leenock | Z | EU |
| Leenock | Z | EU |
| Leenock | Z | KR |
| Life | Z | AM |
| Life | Z | AM |
| Life | Z | EU |
| Life | Z | EU |
| Life | Z | KR |
| Life | Z | KR |
| Life | Z | KR |
| Life | Z | KR |
| Life | Z | EU |
| DongRaeGu | Z | KR |
| DongRaeGu | Z | KR |
| DongRaeGu | Z | AM |
| DongRaeGu | Z | AM |
| DongRaeGu | Z | AM |
| DongRaeGu | Z | KR |
| DongRaeGu | Z | EU |
| DongRaeGu | Z | KR |
| PartinG | P | AM |
| TaeJa | T | KR |
| TaeJa | T | AM |
| TaeJa | T | KR |
| TaeJa | T | EU |
| TaeJa | T | KR |
| TaeJa | T | KR |
| TaeJa | T | EU |
| TaeJa | T | EU |
| TaeJa | T | EU |
| TaeJa | T | KR |
| TaeJa | T | EU |
| TaeJa | T | KR |
| TaeJa | T | KR |
| TaeJa | T | KR |
| TaeJa | T | KR |
| TaeJa | T | KR |
| viOLet | Z | AM |
| viOLet | Z | AM |
| viOLet | Z | EU |
| HerO | P | AM |
| HerO | P | AM |
| HerO | P | EU |
| HerO | P | EU |
| HerO | P | AM |
| SjoW | T | EU |
| SjoW | T | EU |
| SjoW | T | EU |
| SjoW | T | EU |
| SjoW | T | EU |
これは機能していないようです。それはPartingを後に残し、SjoWはすべてEUを持っています。 – noobprogrammer1987