I have manage to code the following subquery:
select max(x.maxcon) as MaxWins from (select if(@prev=outcome,@c:=@c+1,@c:=0) as maxcon, @prev := 2 from cc6_MixedLeague_rounds, (select @prev:=-1,@c:=1) var where player = 18 and date between '2019-05-01' and '2019-08-31') x;
Fiddle found at https://www.db-fiddle.com/f/d9UwNMahAo354Uxe8L9T7P/0
It does exactly what I need it to do, however, I need something that will work with a single select query instead of a subquery.
The problem, is passing a variable to the subquery, specifically "player = 18". I'd like 18 to be variable.
Any ideas?
Aucun commentaire:
Enregistrer un commentaire