How to count number of times team is highest scorer in a game from a MySQL cross table? -
i creating mysql database quiz bowl. design have cross table containing game results, cross table having form:
create table game_results( id smallint not null auto_increment primary key, game_id mediumint not null, team_id smallint not null, score mediumint); my question how 1 count number of wins team has (that is, number of times team highest scoring team in particular game) table game_results using mysql.
select count(1) wins game_results gr1 left join game_results gr2 on gr1.game_id=gr2.game_id , gr2.team_id != 1234 gr1.team_id = 1234 , gr1.score > gr2.score
Comments
Post a Comment