mysql - Error 1111 when calling a stored function -


so found post talked putting logic tests behind having instead of where. missing that's still tripping error 1111?

drop procedure if exists elo;  delimiter //  create procedure elo() begin  -- declares...  label1: while xgame <= max(games.game_id)      select games.game_id, games.game_type, games.date, games.home_team, games.away_team, games.runs0, games.runs1          games         games.game_id = xgame          having (games.game_type = 0 or games.game_type = 3)         @id, @ty, @d, @home, @away, @homer, @awayr;      set starthomeelo = (select team_elo.team_id, team_elo.date, team_elo.elo team_elo team_id = home having min(d - team_elo.date));     set startawayelo = (select team_elo.team_id, team_elo.date, team_elo.elo team_elo team_id = away having min(d - team_elo.date));      set elodiff = abs((starthomeelo + 25) - startawayelo);      set homeelo = (starthomeelo + (40*power(rundiff, (1/3)) * (homewin - (1/(power(10, (elodiff/400)) + 1)))));     set awayelo = (startawayelo + (40*power(rundiff, (1/3)) * (awaywin - (1/(power(10, (elodiff/400)) + 1)))));      insert team_elo (team_id, game_id, date, elo) values (home, id, d, homeelo);     insert team_elo (team_id, game_id, date, elo) values (away, id, d, awayelo);      set xgame = xgame + 1;   end while label1; end; //  call elo();  

you need separate query maximum id:

int maxid;  select max(game_id) maxid games;  label1: while xgame <= maxid     ... end while label1; 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -