Kueri dalam menghitung setiap coretan. Kueri luar mendapatkan maks per pengguna. Kueri belum diuji (tetapi berdasarkan kueri yang berfungsi)
set @user_id = null;
set @streak = 1;
select user_id, max(streak) from (
SELECT user_id, streak,
case when @user_id is null OR @user_id != user_id then @streak := 1 else @streak := @streak + 1 end as streak_formula,
@user_id := user_id,
@streak as streak
FROM my_table
) foo
group by user_id