0
クエリ(編集済みフォーマット):マックス()関数()
SELECT
league_id as League, TeamId, MAX(TotalGoals) as Goals,season
FROM
(SELECT
league_id, TeamId, SUM(TeamGoals) AS TotalGoals, season
FROM
(SELECT
league_id,
season ,
home_team_api_id AS TeamId,
SUM(home_team_goal) AS TeamGoals
FROM
games
GROUP BY TeamId , league_id , season UNION SELECT
league_id,
season,
away_team_api_id AS TeamId,
SUM(away_team_goal) AS TeamGoals
FROM
games
GROUP BY TeamId , league_id , season) t1
GROUP BY TeamId , season) g3
GROUP BY league_id , season;
私はマックス(のために間違った答えを取得しています)私が間違っているつもりですどこ私に知らせてください。?
は次のリンクを参照してください。 https://stackoverflow.com/questions/7759347/can-we-use-sum-and-max-function-with-each-other-in-sql-statement – varman