drelefun
Technical User
- Apr 16, 2008
- 15
I’m trying to get the total score for a home and away team but not sure how to. Basically the way to get the score is goals x 6 + behinds. This only gets that quarter’s score and I want to group it by the team and game to get total score. I’m also not sure how to differentiate the team in this situation. I know it has something to do with a CASE statement but not sure how to do it.
the query below is as far as i could get. It can get the scores for each quarter but i want to group by quarters to get a final score. I also want to add the score for the away team after away.team AS Away.
SELECT AFLGame.date, AFLGame.round, home.team AS Home, AFLScore.goals * 6 + AFLScore.behinds AS Home Score, away.team AS Away, Venue.venue
FROM AFLGame INNER JOIN
Venue ON AFLGame.venue_id = Venue.venue_id INNER JOIN
Team AS home ON AFLGame.home = home.team_id INNER JOIN
Team AS away ON AFLGame.away = away.team_id INNER JOIN
AFLScore ON AFLGame.aflgame_id = AFLScore.aflgame_id
the tables involved are
AFLGame (aflGame_id, date, round, home(fk), away(fk), day_night, crowd, venue_id)
AFLScore(team_id, quarter, goals, behinds)
Team(team_id, team)
thanks for any help
the query below is as far as i could get. It can get the scores for each quarter but i want to group by quarters to get a final score. I also want to add the score for the away team after away.team AS Away.
SELECT AFLGame.date, AFLGame.round, home.team AS Home, AFLScore.goals * 6 + AFLScore.behinds AS Home Score, away.team AS Away, Venue.venue
FROM AFLGame INNER JOIN
Venue ON AFLGame.venue_id = Venue.venue_id INNER JOIN
Team AS home ON AFLGame.home = home.team_id INNER JOIN
Team AS away ON AFLGame.away = away.team_id INNER JOIN
AFLScore ON AFLGame.aflgame_id = AFLScore.aflgame_id
the tables involved are
AFLGame (aflGame_id, date, round, home(fk), away(fk), day_night, crowd, venue_id)
AFLScore(team_id, quarter, goals, behinds)
Team(team_id, team)
thanks for any help