使用临时变量
SELECT player_id,CONVERT(max(temp),UNSIGNED INTEGER) longest_streak from(
SELECT *,@p:=(case when @q=player_id and result = 'Win' then @p+1
when result != 'Win' then 0
else 1 end) temp
, @q:=player_id from
(SELECT * FROM Matches order by player_id,match_day) t,(SELECT @p:=0, @q:=NULL) init) t group by player_id