Copied! Copy Stacktrace Search Stackoverflow Search Google Exception

Database Exceptionyii\db\Exception

SQLSTATE[HY000]: General error: 1117 Too many columns
The SQL being executed was: SELECT COUNT(*) FROM (SELECT ROW_NUMBER() OVER (PARTITION BY stage_name, group_name ORDER BY overall_points DESC, total_goal_difference DESC, overall_goals_scored DESC) as position, ROW_NUMBER() OVER (PARTITION BY stage_name, group_name ORDER BY overall_points_exp DESC, total_goal_difference_exp DESC, overall_goals_scored_exp DESC) as position_exp,
ROW_NUMBER() OVER (PARTITION BY stage_name, group_name ORDER BY home_points DESC, home_diff DESC, home_goals_scored DESC) as home_position, ROW_NUMBER() OVER (PARTITION BY stage_name, group_name ORDER BY home_points_exp DESC, home_diff_exp DESC, home_goals_scored_exp DESC) as home_position_exp,
ROW_NUMBER() OVER (PARTITION BY stage_name, group_name ORDER BY away_points DESC, away_diff DESC, away_goals_scored DESC) as away_position, ROW_NUMBER() OVER (PARTITION BY stage_name, group_name ORDER BY away_points_exp DESC, away_diff_exp DESC, away_goals_scored_exp DESC) as away_position_exp,
sfinal.*,
SUM(overall_games_played) OVER total_window / 2 AS season_games_played, SUM(overall_won) OVER total_window / 2 AS season_won, SUM(overall_draw) OVER total_window / 2 AS season_draw, SUM(overall_lost) OVER total_window / 2 AS season_lost, SUM(overall_goals_scored) OVER total_window AS season_goals_scored, SUM(overall_goals_against) OVER total_window AS season_goals_against,
SUM(home_games_played) OVER total_window AS season_home_games_played, SUM(home_won) OVER total_window AS season_home_won, SUM(home_draw) OVER total_window AS season_home_draw, SUM(home_lost) OVER total_window AS season_home_lost, SUM(home_goals_scored) OVER total_window AS season_home_goals_scored, SUM(home_goals_against) OVER total_window AS season_home_goals_against,
SUM(away_games_played) OVER total_window AS season_away_games_played, SUM(away_won) OVER total_window AS season_away_won, SUM(away_draw) OVER total_window AS season_away_draw, SUM(away_lost) OVER total_window AS season_away_lost, SUM(away_goals_scored) OVER total_window AS season_away_goals_scored, SUM(away_goals_against) OVER total_window AS season_away_goals_against,
SUM(total_goal_difference) OVER total_window AS season_goal_difference,
SUM(overall_points) OVER total_window AS season_points,
SUM(overall_goals_scored) OVER total_window - SUM(overall_goals_against) OVER total_window AS season_diff, SUM(home_goals_scored) OVER total_window - SUM(home_goals_against) OVER total_window AS season_home_diff, SUM(away_goals_scored) OVER total_window - SUM(away_goals_against) OVER total_window AS season_away_diff,
SUM(overall_goals_scored) OVER total_window / SUM(overall_goals_against) OVER total_window AS season_strength, SUM(home_goals_scored) OVER total_window / SUM(home_goals_against) OVER total_window AS season_home_strength, SUM(away_goals_scored) OVER total_window / SUM(away_goals_against) OVER total_window AS season_away_strength,

SUM(overall_games_played_exp) OVER total_window / 2 AS season_games_played_exp, SUM(overall_won_exp) OVER total_window / 2 AS season_won_exp, SUM(overall_draw_exp) OVER total_window / 2 AS season_draw_exp, SUM(overall_lost_exp) OVER total_window / 2 AS season_lost_exp, SUM(overall_goals_scored_exp) OVER total_window AS season_goals_scored_exp, SUM(overall_goals_against_exp) OVER total_window AS season_goals_against_exp,
SUM(home_games_played_exp) OVER total_window AS season_home_games_played_exp, SUM(home_won_exp) OVER total_window AS season_home_won_exp, SUM(home_draw_exp) OVER total_window AS season_home_draw_exp, SUM(home_lost_exp) OVER total_window AS season_home_lost_exp, SUM(home_goals_scored_exp) OVER total_window AS season_home_goals_scored_exp, SUM(home_goals_against_exp) OVER total_window AS season_home_goals_against_exp,
SUM(away_games_played_exp) OVER total_window AS season_away_games_played_exp, SUM(away_won_exp) OVER total_window AS season_away_won_exp, SUM(away_draw_exp) OVER total_window AS season_away_draw_exp, SUM(away_lost_exp) OVER total_window AS season_away_lost_exp, SUM(away_goals_scored_exp) OVER total_window AS season_away_goals_scored_exp, SUM(away_goals_against_exp) OVER total_window AS season_away_goals_against_exp,
SUM(total_goal_difference_exp) OVER total_window AS season_goal_difference_exp,
SUM(overall_points_exp) OVER total_window AS season_points_exp,
SUM(overall_goals_scored_exp) OVER total_window - SUM(overall_goals_against_exp) OVER total_window AS season_diff_exp, SUM(home_goals_scored_exp) OVER total_window - SUM(home_goals_against_exp) OVER total_window AS season_home_diff_exp, SUM(away_goals_scored_exp) OVER total_window - SUM(away_goals_against_exp) OVER total_window AS season_away_diff_exp,
SUM(overall_goals_scored_exp) OVER total_window / SUM(overall_goals_against_exp) OVER total_window AS season_strength_exp, SUM(home_goals_scored_exp) OVER total_window / SUM(home_goals_against_exp) OVER total_window AS season_home_strength_exp, SUM(away_goals_scored_exp) OVER total_window / SUM(away_goals_against_exp) OVER total_window AS season_away_strength_exp, SUM(stats_games) OVER total_window / SUM(overall_games_played) OVER total_window AS season_stats_games_avg, SUM(shots_total) OVER total_window / SUM(overall_games_played) OVER total_window AS season_shots_total_avg, SUM(shots_ongoal) OVER total_window / SUM(overall_games_played) OVER total_window AS season_shots_ongoal_avg, SUM(shots_blocked) OVER total_window / SUM(overall_games_played) OVER total_window AS season_shots_blocked_avg, SUM(shots_offgoal) OVER total_window / SUM(overall_games_played) OVER total_window AS season_shots_offgoal_avg, SUM(shots_insidebox) OVER total_window / SUM(overall_games_played) OVER total_window AS season_shots_insidebox_avg, SUM(shots_outsidebox) OVER total_window / SUM(overall_games_played) OVER total_window AS season_shots_outsidebox_avg, SUM(passes_total) OVER total_window / SUM(overall_games_played) OVER total_window AS season_passes_total_avg, SUM(passes_accurate) OVER total_window / SUM(overall_games_played) OVER total_window AS season_passes_accurate_avg, (SUM(passes_accurate) OVER total_window / SUM(overall_games_played) OVER total_window) / (SUM(passes_total) OVER total_window / SUM(overall_games_played) OVER total_window) * 100 AS season_passes_percentage_avg, SUM(attacks_attacks) OVER total_window / SUM(overall_games_played) OVER total_window AS season_attacks_attacks_avg, SUM(attacks_dangerous_attacks) OVER total_window / SUM(overall_games_played) OVER total_window AS season_attacks_dangerous_attacks_avg, SUM(fouls) OVER total_window / SUM(overall_games_played) OVER total_window AS season_fouls_avg, SUM(corners) OVER total_window / SUM(overall_games_played) OVER total_window AS season_corners_avg, SUM(offsides) OVER total_window / SUM(overall_games_played) OVER total_window AS season_offsides_avg, SUM(possessiontime) OVER total_window / SUM(overall_games_played) OVER total_window AS season_possessiontime_avg, SUM(yellowcards) OVER total_window / SUM(overall_games_played) OVER total_window AS season_yellowcards_avg, SUM(saves) OVER total_window / SUM(overall_games_played) OVER total_window AS season_saves_avg, SUM(substitutions) OVER total_window / SUM(overall_games_played) OVER total_window AS season_substitutions_avg, SUM(goal_attempts) OVER total_window / SUM(overall_games_played) OVER total_window AS season_goal_attempts_avg, SUM(ball_safe) OVER total_window / SUM(overall_games_played) OVER total_window AS season_ball_safe_avg, SUM(goals) OVER total_window / SUM(overall_games_played) OVER total_window AS season_goals_avg, SUM(tackles) OVER total_window / SUM(overall_games_played) OVER total_window AS season_tackles_avg, SUM(injuries) OVER total_window / SUM(overall_games_played) OVER total_window AS season_injuries_avg, SUM(goal_kick) OVER total_window / SUM(overall_games_played) OVER total_window AS season_goal_kick_avg, SUM(free_kick) OVER total_window / SUM(overall_games_played) OVER total_window AS season_free_kick_avg, SUM(throw_in) OVER total_window / SUM(overall_games_played) OVER total_window AS season_throw_in_avg, SUM(penalties) OVER total_window / SUM(overall_games_played) OVER total_window AS season_penalties_avg, SUM(redcards) OVER total_window / SUM(overall_games_played) OVER total_window AS season_redcards_avg, SUM(yellowredcards) OVER total_window / SUM(overall_games_played) OVER total_window AS season_yellowredcards_avg, ((stats_games / overall_games_played) - (SUM(stats_games) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(stats_games) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_stats_games_perc, ((shots_total / overall_games_played) - (SUM(shots_total) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(shots_total) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_shots_total_perc, ((shots_ongoal / overall_games_played) - (SUM(shots_ongoal) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(shots_ongoal) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_shots_ongoal_perc, ((shots_blocked / overall_games_played) - (SUM(shots_blocked) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(shots_blocked) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_shots_blocked_perc, ((shots_offgoal / overall_games_played) - (SUM(shots_offgoal) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(shots_offgoal) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_shots_offgoal_perc, ((shots_insidebox / overall_games_played) - (SUM(shots_insidebox) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(shots_insidebox) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_shots_insidebox_perc, ((shots_outsidebox / overall_games_played) - (SUM(shots_outsidebox) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(shots_outsidebox) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_shots_outsidebox_perc, ((passes_total / overall_games_played) - (SUM(passes_total) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(passes_total) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_passes_total_perc, ((passes_accurate / overall_games_played) - (SUM(passes_accurate) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(passes_accurate) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_passes_accurate_perc, ((attacks_attacks / overall_games_played) - (SUM(attacks_attacks) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(attacks_attacks) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_attacks_attacks_perc, ((attacks_dangerous_attacks / overall_games_played) - (SUM(attacks_dangerous_attacks) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(attacks_dangerous_attacks) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_attacks_dangerous_attacks_perc, ((fouls / overall_games_played) - (SUM(fouls) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(fouls) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_fouls_perc, ((corners / overall_games_played) - (SUM(corners) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(corners) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_corners_perc, ((offsides / overall_games_played) - (SUM(offsides) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(offsides) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_offsides_perc, ((possessiontime / overall_games_played) - (SUM(possessiontime) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(possessiontime) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_possessiontime_perc, ((yellowcards / overall_games_played) - (SUM(yellowcards) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(yellowcards) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_yellowcards_perc, ((saves / overall_games_played) - (SUM(saves) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(saves) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_saves_perc, ((substitutions / overall_games_played) - (SUM(substitutions) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(substitutions) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_substitutions_perc, ((goal_attempts / overall_games_played) - (SUM(goal_attempts) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(goal_attempts) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_goal_attempts_perc, ((ball_safe / overall_games_played) - (SUM(ball_safe) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(ball_safe) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_ball_safe_perc, ((goals / overall_games_played) - (SUM(goals) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(goals) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_goals_perc, ((tackles / overall_games_played) - (SUM(tackles) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(tackles) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_tackles_perc, ((injuries / overall_games_played) - (SUM(injuries) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(injuries) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_injuries_perc, ((goal_kick / overall_games_played) - (SUM(goal_kick) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(goal_kick) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_goal_kick_perc, ((free_kick / overall_games_played) - (SUM(free_kick) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(free_kick) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_free_kick_perc, ((throw_in / overall_games_played) - (SUM(throw_in) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(throw_in) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_throw_in_perc, ((penalties / overall_games_played) - (SUM(penalties) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(penalties) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_penalties_perc, ((redcards / overall_games_played) - (SUM(redcards) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(redcards) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_redcards_perc, ((yellowredcards / overall_games_played) - (SUM(yellowredcards) OVER total_window / SUM(overall_games_played) OVER total_window)) / (SUM(yellowredcards) OVER total_window / SUM(overall_games_played) OVER total_window) AS season_yellowredcards_perc, 0 AS season_stats_games_exp_avg, 0 AS season_shots_total_exp_avg, 0 AS season_shots_ongoal_exp_avg, 0 AS season_shots_blocked_exp_avg, 0 AS season_shots_offgoal_exp_avg, 0 AS season_shots_insidebox_exp_avg, 0 AS season_shots_outsidebox_exp_avg, 0 AS season_passes_total_exp_avg, 0 AS season_passes_accurate_exp_avg, 0 AS season_passes_percentage_exp_avg, 0 AS season_attacks_attacks_exp_avg, 0 AS season_attacks_dangerous_attacks_exp_avg, 0 AS season_fouls_exp_avg, 0 AS season_corners_exp_avg, 0 AS season_offsides_exp_avg, 0 AS season_possessiontime_exp_avg, 0 AS season_yellowcards_exp_avg, 0 AS season_saves_exp_avg, 0 AS season_substitutions_exp_avg, 0 AS season_goal_attempts_exp_avg, 0 AS season_ball_safe_exp_avg, 0 AS season_goals_exp_avg, 0 AS season_tackles_exp_avg, 0 AS season_injuries_exp_avg, 0 AS season_goal_kick_exp_avg, 0 AS season_free_kick_exp_avg, 0 AS season_throw_in_exp_avg, 0 AS season_penalties_exp_avg, 0 AS season_redcards_exp_avg, 0 AS season_yellowredcards_exp_avg, 0 AS season_stats_games_exp_perc, 0 AS season_shots_total_exp_perc, 0 AS season_shots_ongoal_exp_perc, 0 AS season_shots_blocked_exp_perc, 0 AS season_shots_offgoal_exp_perc, 0 AS season_shots_insidebox_exp_perc, 0 AS season_shots_outsidebox_exp_perc, 0 AS season_passes_total_exp_perc, 0 AS season_passes_accurate_exp_perc, 0 AS season_attacks_attacks_exp_perc, 0 AS season_attacks_dangerous_attacks_exp_perc, 0 AS season_fouls_exp_perc, 0 AS season_corners_exp_perc, 0 AS season_offsides_exp_perc, 0 AS season_possessiontime_exp_perc, 0 AS season_yellowcards_exp_perc, 0 AS season_saves_exp_perc, 0 AS season_substitutions_exp_perc, 0 AS season_goal_attempts_exp_perc, 0 AS season_ball_safe_exp_perc, 0 AS season_goals_exp_perc, 0 AS season_tackles_exp_perc, 0 AS season_injuries_exp_perc, 0 AS season_goal_kick_exp_perc, 0 AS season_free_kick_exp_perc, 0 AS season_throw_in_exp_perc, 0 AS season_penalties_exp_perc, 0 AS season_redcards_exp_perc, 0 AS season_yellowredcards_exp_perc
FROM
(SELECT AVG(fair1.calc_odd) as fair_1, AVG(stat1.min_value) as min_1, AVG(stat1.avg_value) as avg_1, AVG(stat1.max_value) as max_1, AVG(stat1.winning) as winning_1, SUM(fair1.my_bet) as my_bet_1, AVG(fair1.my_bet_odd) as my_bet_odd_1,
AVG(fairX.calc_odd) as fair_X, AVG(statX.min_value) as min_X, AVG(statX.avg_value) as avg_X, AVG(statX.max_value) as max_X, AVG(statX.winning) as winning_X, SUM(fairX.my_bet) as my_bet_X, AVG(fairX.my_bet_odd) as my_bet_odd_X,
AVG(fair2.calc_odd) as fair_2, AVG(stat2.min_value) as min_2, AVG(stat2.avg_value) as avg_2, AVG(stat2.max_value) as max_2, AVG(stat2.winning) as winning_2, SUM(fair2.my_bet) as my_bet_2, AVG(fair2.my_bet_odd) as my_bet_odd_2,

(
SUM(
(
1 / IF(stat1.winning IS NOT NULL AND stat1.winning=1,fair1.calc_odd,
IF(statX.winning IS NOT NULL AND statX.winning=1,fairX.calc_odd,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,fair2.calc_odd,0)))
)
*
IF(stat1.winning IS NOT NULL AND stat1.winning=1,stat1.min_value,
IF(statX.winning IS NOT NULL AND statX.winning=1,statX.min_value,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,stat2.min_value,0)))
) / 2
- (COUNT(*) / 2)
) / (COUNT(*) / 2) * 100
as win_min,

(
SUM(
(
1 / IF(stat1.winning IS NOT NULL AND stat1.winning=1,fair1.calc_odd,
IF(statX.winning IS NOT NULL AND statX.winning=1,fairX.calc_odd,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,fair2.calc_odd,0)))
)
*
IF(stat1.winning IS NOT NULL AND stat1.winning=1,stat1.avg_value,
IF(statX.winning IS NOT NULL AND statX.winning=1,statX.avg_value,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,stat2.avg_value,0)))
) / 2
- (COUNT(*) / 2)
) / (COUNT(*) / 2) * 100
as win_avg,

(
SUM(
(
1 / IF(stat1.winning IS NOT NULL AND stat1.winning=1,fair1.calc_odd,
IF(statX.winning IS NOT NULL AND statX.winning=1,fairX.calc_odd,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,fair2.calc_odd,0)))
)
*
IF(stat1.winning IS NOT NULL AND stat1.winning=1,stat1.max_value,
IF(statX.winning IS NOT NULL AND statX.winning=1,statX.max_value,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,stat2.max_value,0)))
) / 2
- (COUNT(*) / 2)
) / (COUNT(*) / 2) * 100
as win_max,


(
SUM(
(
1 / IF(stat1.winning IS NOT NULL AND stat1.winning=1,fair1.calc_odd,
IF(statX.winning IS NOT NULL AND statX.winning=1,fairX.calc_odd,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,fair2.calc_odd,0)))
)
*
IF(stat1.winning IS NOT NULL AND stat1.winning=1,stat1.min_value,
IF(statX.winning IS NOT NULL AND statX.winning=1,statX.min_value,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,stat2.min_value,0)))
*
(1/stat1.min_value + 1/statX.min_value + 1/stat2.min_value)
) / 2
- (COUNT(*) / 2)
) / (COUNT(*) / 2) * 100
as win_min_std,

(
SUM(
(
1 / IF(stat1.winning IS NOT NULL AND stat1.winning=1,fair1.calc_odd,
IF(statX.winning IS NOT NULL AND statX.winning=1,fairX.calc_odd,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,fair2.calc_odd,0)))
)
*
IF(stat1.winning IS NOT NULL AND stat1.winning=1,stat1.avg_value,
IF(statX.winning IS NOT NULL AND statX.winning=1,statX.avg_value,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,stat2.avg_value,0)))
*
(1/stat1.avg_value + 1/statX.avg_value + 1/stat2.avg_value)
) / 2
- (COUNT(*) / 2)
) / (COUNT(*) / 2) * 100
as win_avg_std,

(
SUM(
(
1 / IF(stat1.winning IS NOT NULL AND stat1.winning=1,fair1.calc_odd,
IF(statX.winning IS NOT NULL AND statX.winning=1,fairX.calc_odd,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,fair2.calc_odd,0)))
)
*
IF(stat1.winning IS NOT NULL AND stat1.winning=1,stat1.max_value,
IF(statX.winning IS NOT NULL AND statX.winning=1,statX.max_value,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,stat2.max_value,0)))
*
(1/stat1.min_value + 1/statX.min_value + 1/stat2.min_value)
) / 2
- (COUNT(*) / 2)
) / (COUNT(*) / 2) * 100
as win_max_std,

(

(
SUM(
(
1 / IF(stat1.winning IS NOT NULL AND stat1.winning=1,fair1.calc_odd,
IF(statX.winning IS NOT NULL AND statX.winning=1,fairX.calc_odd,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,fair2.calc_odd,0)))
)
*
IF(stat1.winning IS NOT NULL AND stat1.winning=1,stat1.min_value,
IF(statX.winning IS NOT NULL AND statX.winning=1,statX.min_value,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,stat2.min_value,0)))
*
(1/stat1.min_value + 1/statX.min_value + 1/stat2.min_value)
) / 2
- (COUNT(*) / 2)
) / (COUNT(*) / 2) * 100

+

(
SUM(
(
1 / IF(stat1.winning IS NOT NULL AND stat1.winning=1,fair1.calc_odd,
IF(statX.winning IS NOT NULL AND statX.winning=1,fairX.calc_odd,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,fair2.calc_odd,0)))
)
*
IF(stat1.winning IS NOT NULL AND stat1.winning=1,stat1.avg_value,
IF(statX.winning IS NOT NULL AND statX.winning=1,statX.avg_value,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,stat2.avg_value,0)))
*
(1/stat1.avg_value + 1/statX.avg_value + 1/stat2.avg_value)
) / 2
- (COUNT(*) / 2)
) / (COUNT(*) / 2) * 100

+

(
SUM(
(
1 / IF(stat1.winning IS NOT NULL AND stat1.winning=1,fair1.calc_odd,
IF(statX.winning IS NOT NULL AND statX.winning=1,fairX.calc_odd,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,fair2.calc_odd,0)))
)
*
IF(stat1.winning IS NOT NULL AND stat1.winning=1,stat1.max_value,
IF(statX.winning IS NOT NULL AND statX.winning=1,statX.max_value,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,stat2.max_value,0)))
*
(1/stat1.min_value + 1/statX.min_value + 1/stat2.min_value)
) / 2
- (COUNT(*) / 2)
) / (COUNT(*) / 2) * 100

) / 3 as win_std,

COUNT(*) as checkrows,




SUM(IF(stat1.winning IS NOT NULL AND stat1.winning=1,fair1.my_bet,
IF(statX.winning IS NOT NULL AND statX.winning=1,fairX.my_bet,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,fair2.my_bet,0)))
*
IF(stat1.winning IS NOT NULL AND stat1.winning=1,fair1.my_bet_odd,
IF(statX.winning IS NOT NULL AND statX.winning=1,fairX.my_bet_odd,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,fair2.my_bet_odd,0)))

) / 2
as winning_my_bet_win,

SUM(IF(stat1.winning IS NOT NULL AND stat1.winning=1,
IF(fairX.my_bet IS NULL, 0, fairX.my_bet) + IF(fair2.my_bet IS NULL, 0, fair2.my_bet),
IF(statX.winning IS NOT NULL AND statX.winning=1,
IF(fair1.my_bet IS NULL, 0, fair1.my_bet)+IF(fair2.my_bet IS NULL, 0, fair2.my_bet),
IF(stat2.winning IS NOT NULL AND stat2.winning=1,
IF(fair1.my_bet IS NULL, 0, fair1.my_bet)+IF(fairX.my_bet IS NULL, 0, fairX.my_bet),0)))
) / 2
as loosing_my_bet,

SUM(IF(stat1.winning IS NOT NULL AND stat1.winning=1,fair1.my_bet,
IF(statX.winning IS NOT NULL AND statX.winning=1,fairX.my_bet,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,fair2.my_bet,0))) *
IF(stat1.winning IS NOT NULL AND stat1.winning=1,fair1.my_bet_odd,
IF(statX.winning IS NOT NULL AND statX.winning=1,fairX.my_bet_odd,
IF(stat2.winning IS NOT NULL AND stat2.winning=1,fair2.my_bet_odd,0)))
) / 2
-
SUM(IF(stat1.winning IS NOT NULL AND stat1.winning=1,
IF(fairX.my_bet IS NULL, 0, fairX.my_bet) + IF(fair2.my_bet IS NULL, 0, fair2.my_bet),
IF(statX.winning IS NOT NULL AND statX.winning=1,
IF(fair1.my_bet IS NULL, 0, fair1.my_bet)+IF(fair2.my_bet IS NULL, 0, fair2.my_bet),
IF(stat2.winning IS NOT NULL AND stat2.winning=1,
IF(fair1.my_bet IS NULL, 0, fair1.my_bet)+IF(fairX.my_bet IS NULL, 0, fairX.my_bet),0)))
) / 2
as earning_my_bet,
league_id, season_id, stage_id, group_id, team_id, t.name as team_name, stage_name AS stage_name, group_name AS group_name, '' AS recent_form,
SUM(overall_games_played) / 1 AS overall_games_played, SUM(overall_won) / 1 AS overall_won, SUM(overall_draw) / 1 AS overall_draw, SUM(overall_lost) / 1 AS overall_lost, SUM(overall_goals_scored) / 1 AS overall_goals_scored, SUM(overall_goals_against) / 1 AS overall_goals_against,
SUM(home_games_played) AS home_games_played, SUM(home_won) AS home_won, SUM(home_draw) AS home_draw, SUM(home_lost) AS home_lost, SUM(home_goals_scored) AS home_goals_scored, SUM(home_goals_against) AS home_goals_against,
SUM(away_games_played) AS away_games_played, SUM(away_won) AS away_won, SUM(away_draw) AS away_draw, SUM(away_lost) AS away_lost, SUM(away_goals_scored) AS away_goals_scored, SUM(away_goals_against) AS away_goals_against,
SUM(total_goal_difference) / 1 AS total_goal_difference,
SUM(points) / 1 AS overall_points, SUM(home_points) AS home_points, SUM(away_points) AS away_points,
SUM(overall_goals_scored) / 1 - SUM(overall_goals_against) / 1 AS overall_diff, SUM(home_goals_scored) - SUM(home_goals_against) AS home_diff, SUM(away_goals_scored) - SUM(away_goals_against) AS away_diff,
SUM(overall_goals_scored) / 1 / SUM(overall_goals_against) / 1 AS overall_strength, SUM(home_goals_scored) / SUM(home_goals_against) AS home_strength, SUM(away_goals_scored) / SUM(away_goals_against) AS away_strength,

SUM(overall_games_played_exp) / 1 AS overall_games_played_exp, SUM(overall_won_exp) / 1 AS overall_won_exp, SUM(overall_draw_exp) / 1 AS overall_draw_exp, SUM(overall_lost_exp) / 1 AS overall_lost_exp, SUM(overall_goals_scored_exp) / 1 AS overall_goals_scored_exp, SUM(overall_goals_against_exp) / 1 AS overall_goals_against_exp,
SUM(home_games_played_exp) AS home_games_played_exp, SUM(home_won_exp) AS home_won_exp, SUM(home_draw_exp) AS home_draw_exp, SUM(home_lost_exp) AS home_lost_exp, SUM(home_goals_scored_exp) AS home_goals_scored_exp, SUM(home_goals_against_exp) AS home_goals_against_exp,
SUM(away_games_played_exp) AS away_games_played_exp, SUM(away_won_exp) AS away_won_exp, SUM(away_draw_exp) AS away_draw_exp, SUM(away_lost_exp) AS away_lost_exp, SUM(away_goals_scored_exp) AS away_goals_scored_exp, SUM(away_goals_against_exp) AS away_goals_against_exp,
SUM(total_goal_difference_exp) / 1 AS total_goal_difference_exp,
SUM(points_exp) / 1 AS overall_points_exp, SUM(home_points_exp) AS home_points_exp, SUM(away_points_exp) AS away_points_exp,
SUM(overall_goals_scored_exp) / 1 - SUM(overall_goals_against_exp) / 1 AS overall_diff_exp, SUM(home_goals_scored_exp) - SUM(home_goals_against_exp) AS home_diff_exp, SUM(away_goals_scored_exp) - SUM(away_goals_against_exp) AS away_diff_exp,
SUM(overall_goals_scored_exp) / 1 / SUM(overall_goals_against_exp) / 1 AS overall_strength_exp, SUM(home_goals_scored_exp) / SUM(home_goals_against_exp) AS home_strength_exp, SUM(away_goals_scored_exp) / SUM(away_goals_against_exp) AS away_strength_exp,

SUM(stats_games) / 1 AS stats_games, SUM(shots_total) / 1 AS shots_total, SUM(shots_ongoal) / 1 AS shots_ongoal, SUM(shots_blocked) / 1 AS shots_blocked, SUM(shots_offgoal) / 1 AS shots_offgoal, SUM(shots_insidebox) / 1 AS shots_insidebox, SUM(shots_outsidebox) / 1 AS shots_outsidebox, SUM(passes_total) / 1 AS passes_total, SUM(passes_accurate) / 1 AS passes_accurate, (SUM(passes_accurate) / 1) / (SUM(passes_total) / 1)*100 AS passes_percentage, SUM(attacks_attacks) / 1 AS attacks_attacks, SUM(attacks_dangerous_attacks) / 1 AS attacks_dangerous_attacks, SUM(fouls) / 1 AS fouls, SUM(corners) / 1 AS corners, SUM(offsides) / 1 AS offsides, SUM(possessiontime) / 1 AS possessiontime, SUM(yellowcards) / 1 AS yellowcards, SUM(saves) / 1 AS saves, SUM(substitutions) / 1 AS substitutions, SUM(goal_attempts) / 1 AS goal_attempts, SUM(ball_safe) / 1 AS ball_safe, SUM(goals) / 1 AS goals, SUM(tackles) / 1 AS tackles, SUM(injuries) / 1 AS injuries, SUM(goal_kick) / 1 AS goal_kick, SUM(free_kick) / 1 AS free_kick, SUM(throw_in) / 1 AS throw_in, SUM(penalties) / 1 AS penalties, SUM(redcards) / 1 AS redcards, SUM(yellowredcards) / 1 AS yellowredcards,
SUM(against_stats_games) / 1 AS against_stats_games, SUM(against_shots_total) / 1 AS against_shots_total, SUM(against_shots_ongoal) / 1 AS against_shots_ongoal, SUM(against_shots_blocked) / 1 AS against_shots_blocked, SUM(against_shots_offgoal) / 1 AS against_shots_offgoal, SUM(against_shots_insidebox) / 1 AS against_shots_insidebox, SUM(against_shots_outsidebox) / 1 AS against_shots_outsidebox, SUM(against_passes_total) / 1 AS against_passes_total, SUM(against_passes_accurate) / 1 AS against_passes_accurate, (SUM(against_passes_accurate) / 1)/(SUM(against_passes_total) / 1)*100 AS against_passes_percentage, SUM(against_attacks_attacks) / 1 AS against_attacks_attacks, SUM(against_attacks_dangerous_attacks) / 1 AS against_attacks_dangerous_attacks, SUM(against_fouls) / 1 AS against_fouls, SUM(against_corners) / 1 AS against_corners, SUM(against_offsides) / 1 AS against_offsides, SUM(against_possessiontime) / 1 AS against_possessiontime, SUM(against_yellowcards) / 1 AS against_yellowcards, SUM(against_saves) / 1 AS against_saves, SUM(against_substitutions) / 1 AS against_substitutions, SUM(against_goal_attempts) / 1 AS against_goal_attempts, SUM(against_ball_safe) / 1 AS against_ball_safe, SUM(against_goals) / 1 AS against_goals, SUM(against_tackles) / 1 AS against_tackles, SUM(against_injuries) / 1 AS against_injuries, SUM(against_goal_kick) / 1 AS against_goal_kick, SUM(against_free_kick) / 1 AS against_free_kick, SUM(against_throw_in) / 1 AS against_throw_in, SUM(against_penalties) / 1 AS against_penalties, SUM(against_redcards) / 1 AS against_redcards, SUM(against_yellowredcards) / 1 AS against_yellowredcards, (SUM(stats_games) / 1) / (SUM(against_stats_games) / 1) AS strength_stats_games, (SUM(shots_total) / 1) / (SUM(against_shots_total) / 1) AS strength_shots_total, (SUM(shots_ongoal) / 1) / (SUM(against_shots_ongoal) / 1) AS strength_shots_ongoal, (SUM(shots_blocked) / 1) / (SUM(against_shots_blocked) / 1) AS strength_shots_blocked, (SUM(shots_offgoal) / 1) / (SUM(against_shots_offgoal) / 1) AS strength_shots_offgoal, (SUM(shots_insidebox) / 1) / (SUM(against_shots_insidebox) / 1) AS strength_shots_insidebox, (SUM(shots_outsidebox) / 1) / (SUM(against_shots_outsidebox) / 1) AS strength_shots_outsidebox, (SUM(passes_total) / 1) / (SUM(against_passes_total) / 1) AS strength_passes_total, (SUM(passes_accurate) / 1) / (SUM(against_passes_accurate) / 1) AS strength_passes_accurate, ((SUM(passes_accurate) / 1)/(SUM(passes_total) / 1)*100) / ((SUM(against_passes_accurate) / 1)/(SUM(against_passes_total) / 1)*100) AS strength_passes_percentage, (SUM(attacks_attacks) / 1) / (SUM(against_attacks_attacks) / 1) AS strength_attacks_attacks, (SUM(attacks_dangerous_attacks) / 1) / (SUM(against_attacks_dangerous_attacks) / 1) AS strength_attacks_dangerous_attacks, (SUM(fouls) / 1) / (SUM(against_fouls) / 1) AS strength_fouls, (SUM(corners) / 1) / (SUM(against_corners) / 1) AS strength_corners, (SUM(offsides) / 1) / (SUM(against_offsides) / 1) AS strength_offsides, (SUM(possessiontime) / 1) / (SUM(against_possessiontime) / 1) AS strength_possessiontime, (SUM(yellowcards) / 1) / (SUM(against_yellowcards) / 1) AS strength_yellowcards, (SUM(saves) / 1) / (SUM(against_saves) / 1) AS strength_saves, (SUM(substitutions) / 1) / (SUM(against_substitutions) / 1) AS strength_substitutions, (SUM(goal_attempts) / 1) / (SUM(against_goal_attempts) / 1) AS strength_goal_attempts, (SUM(ball_safe) / 1) / (SUM(against_ball_safe) / 1) AS strength_ball_safe, (SUM(goals) / 1) / (SUM(against_goals) / 1) AS strength_goals, (SUM(tackles) / 1) / (SUM(against_tackles) / 1) AS strength_tackles, (SUM(injuries) / 1) / (SUM(against_injuries) / 1) AS strength_injuries, (SUM(goal_kick) / 1) / (SUM(against_goal_kick) / 1) AS strength_goal_kick, (SUM(free_kick) / 1) / (SUM(against_free_kick) / 1) AS strength_free_kick, (SUM(throw_in) / 1) / (SUM(against_throw_in) / 1) AS strength_throw_in, (SUM(penalties) / 1) / (SUM(against_penalties) / 1) AS strength_penalties, (SUM(redcards) / 1) / (SUM(against_redcards) / 1) AS strength_redcards, (SUM(yellowredcards) / 1) / (SUM(against_yellowredcards) / 1) AS strength_yellowredcards, ((SUM(shots_total) / 1) / (SUM(against_shots_total) / 1) * 1 + (SUM(shots_ongoal) / 1) / (SUM(against_shots_ongoal) / 1) * 1 + (SUM(shots_insidebox) / 1) / (SUM(against_shots_insidebox) / 1) * 1 + (SUM(passes_accurate) / 1) / (SUM(against_passes_accurate) / 1) * 1 + (SUM(attacks_attacks) / 1) / (SUM(against_attacks_attacks) / 1) * 1 + (SUM(attacks_dangerous_attacks) / 1) / (SUM(against_attacks_dangerous_attacks) / 1) * 1 + (SUM(corners) / 1) / (SUM(against_corners) / 1) * 1 + (SUM(possessiontime) / 1) / (SUM(against_possessiontime) / 1) * 1 + (SUM(goal_attempts) / 1) / (SUM(against_goal_attempts) / 1) * 1 ) / 9 AS strength_weighted, SUM(home_stats_games) AS home_stats_games, SUM(home_shots_total) AS home_shots_total, SUM(home_shots_ongoal) AS home_shots_ongoal, SUM(home_shots_blocked) AS home_shots_blocked, SUM(home_shots_offgoal) AS home_shots_offgoal, SUM(home_shots_insidebox) AS home_shots_insidebox, SUM(home_shots_outsidebox) AS home_shots_outsidebox, SUM(home_passes_total) AS home_passes_total, SUM(home_passes_accurate) AS home_passes_accurate, SUM(home_passes_accurate)/SUM(home_passes_total)*100 AS home_passes_percentage, SUM(home_attacks_attacks) AS home_attacks_attacks, SUM(home_attacks_dangerous_attacks) AS home_attacks_dangerous_attacks, SUM(home_fouls) AS home_fouls, SUM(home_corners) AS home_corners, SUM(home_offsides) AS home_offsides, SUM(home_possessiontime) AS home_possessiontime, SUM(home_yellowcards) AS home_yellowcards, SUM(home_saves) AS home_saves, SUM(home_substitutions) AS home_substitutions, SUM(home_goal_attempts) AS home_goal_attempts, SUM(home_ball_safe) AS home_ball_safe, SUM(home_goals) AS home_goals, SUM(home_tackles) AS home_tackles, SUM(home_injuries) AS home_injuries, SUM(home_goal_kick) AS home_goal_kick, SUM(home_free_kick) AS home_free_kick, SUM(home_throw_in) AS home_throw_in, SUM(home_penalties) AS home_penalties, SUM(home_redcards) AS home_redcards, SUM(home_yellowredcards) AS home_yellowredcards,
SUM(home_against_stats_games) AS home_against_stats_games, SUM(home_against_shots_total) AS home_against_shots_total, SUM(home_against_shots_ongoal) AS home_against_shots_ongoal, SUM(home_against_shots_blocked) AS home_against_shots_blocked, SUM(home_against_shots_offgoal) AS home_against_shots_offgoal, SUM(home_against_shots_insidebox) AS home_against_shots_insidebox, SUM(home_against_shots_outsidebox) AS home_against_shots_outsidebox, SUM(home_against_passes_total) AS home_against_passes_total, SUM(home_against_passes_accurate) AS home_against_passes_accurate, SUM(home_against_passes_accurate)/SUM(home_against_passes_total)*100 AS home_against_passes_percentage, SUM(home_against_attacks_attacks) AS home_against_attacks_attacks, SUM(home_against_attacks_dangerous_attacks) AS home_against_attacks_dangerous_attacks, SUM(home_against_fouls) AS home_against_fouls, SUM(home_against_corners) AS home_against_corners, SUM(home_against_offsides) AS home_against_offsides, SUM(home_against_possessiontime) AS home_against_possessiontime, SUM(home_against_yellowcards) AS home_against_yellowcards, SUM(home_against_saves) AS home_against_saves, SUM(home_against_substitutions) AS home_against_substitutions, SUM(home_against_goal_attempts) AS home_against_goal_attempts, SUM(home_against_ball_safe) AS home_against_ball_safe, SUM(home_against_goals) AS home_against_goals, SUM(home_against_tackles) AS home_against_tackles, SUM(home_against_injuries) AS home_against_injuries, SUM(home_against_goal_kick) AS home_against_goal_kick, SUM(home_against_free_kick) AS home_against_free_kick, SUM(home_against_throw_in) AS home_against_throw_in, SUM(home_against_penalties) AS home_against_penalties, SUM(home_against_redcards) AS home_against_redcards, SUM(home_against_yellowredcards) AS home_against_yellowredcards, SUM(home_stats_games) / SUM(home_against_stats_games) AS home_strength_stats_games, SUM(home_shots_total) / SUM(home_against_shots_total) AS home_strength_shots_total, SUM(home_shots_ongoal) / SUM(home_against_shots_ongoal) AS home_strength_shots_ongoal, SUM(home_shots_blocked) / SUM(home_against_shots_blocked) AS home_strength_shots_blocked, SUM(home_shots_offgoal) / SUM(home_against_shots_offgoal) AS home_strength_shots_offgoal, SUM(home_shots_insidebox) / SUM(home_against_shots_insidebox) AS home_strength_shots_insidebox, SUM(home_shots_outsidebox) / SUM(home_against_shots_outsidebox) AS home_strength_shots_outsidebox, SUM(home_passes_total) / SUM(home_against_passes_total) AS home_strength_passes_total, SUM(home_passes_accurate) / SUM(home_against_passes_accurate) AS home_strength_passes_accurate, (SUM(home_passes_accurate)/SUM(home_passes_total)*100) / (SUM(home_against_passes_accurate)/SUM(home_against_passes_total)*100) AS home_strength_passes_percentage, SUM(home_attacks_attacks) / SUM(home_against_attacks_attacks) AS home_strength_attacks_attacks, SUM(home_attacks_dangerous_attacks) / SUM(home_against_attacks_dangerous_attacks) AS home_strength_attacks_dangerous_attacks, SUM(home_fouls) / SUM(home_against_fouls) AS home_strength_fouls, SUM(home_corners) / SUM(home_against_corners) AS home_strength_corners, SUM(home_offsides) / SUM(home_against_offsides) AS home_strength_offsides, SUM(home_possessiontime) / SUM(home_against_possessiontime) AS home_strength_possessiontime, SUM(home_yellowcards) / SUM(home_against_yellowcards) AS home_strength_yellowcards, SUM(home_saves) / SUM(home_against_saves) AS home_strength_saves, SUM(home_substitutions) / SUM(home_against_substitutions) AS home_strength_substitutions, SUM(home_goal_attempts) / SUM(home_against_goal_attempts) AS home_strength_goal_attempts, SUM(home_ball_safe) / SUM(home_against_ball_safe) AS home_strength_ball_safe, SUM(home_goals) / SUM(home_against_goals) AS home_strength_goals, SUM(home_tackles) / SUM(home_against_tackles) AS home_strength_tackles, SUM(home_injuries) / SUM(home_against_injuries) AS home_strength_injuries, SUM(home_goal_kick) / SUM(home_against_goal_kick) AS home_strength_goal_kick, SUM(home_free_kick) / SUM(home_against_free_kick) AS home_strength_free_kick, SUM(home_throw_in) / SUM(home_against_throw_in) AS home_strength_throw_in, SUM(home_penalties) / SUM(home_against_penalties) AS home_strength_penalties, SUM(home_redcards) / SUM(home_against_redcards) AS home_strength_redcards, SUM(home_yellowredcards) / SUM(home_against_yellowredcards) AS home_strength_yellowredcards, ((SUM(home_shots_total) / 1) / (SUM(home_against_shots_total) / 1) * 1 + (SUM(home_shots_ongoal) / 1) / (SUM(home_against_shots_ongoal) / 1) * 1 + (SUM(home_shots_insidebox) / 1) / (SUM(home_against_shots_insidebox) / 1) * 1 + (SUM(home_passes_accurate) / 1) / (SUM(home_against_passes_accurate) / 1) * 1 + (SUM(home_attacks_attacks) / 1) / (SUM(home_against_attacks_attacks) / 1) * 1 + (SUM(home_attacks_dangerous_attacks) / 1) / (SUM(home_against_attacks_dangerous_attacks) / 1) * 1 + (SUM(home_corners) / 1) / (SUM(home_against_corners) / 1) * 1 + (SUM(home_possessiontime) / 1) / (SUM(home_against_possessiontime) / 1) * 1 + (SUM(home_goal_attempts) / 1) / (SUM(home_against_goal_attempts) / 1) * 1 ) / 9 AS home_strength_weighted, SUM(away_stats_games) AS away_stats_games, SUM(away_shots_total) AS away_shots_total, SUM(away_shots_ongoal) AS away_shots_ongoal, SUM(away_shots_blocked) AS away_shots_blocked, SUM(away_shots_offgoal) AS away_shots_offgoal, SUM(away_shots_insidebox) AS away_shots_insidebox, SUM(away_shots_outsidebox) AS away_shots_outsidebox, SUM(away_passes_total) AS away_passes_total, SUM(away_passes_accurate) AS away_passes_accurate, SUM(away_passes_accurate)/SUM(away_passes_total)*100 AS away_passes_percentage, SUM(away_attacks_attacks) AS away_attacks_attacks, SUM(away_attacks_dangerous_attacks) AS away_attacks_dangerous_attacks, SUM(away_fouls) AS away_fouls, SUM(away_corners) AS away_corners, SUM(away_offsides) AS away_offsides, SUM(away_possessiontime) AS away_possessiontime, SUM(away_yellowcards) AS away_yellowcards, SUM(away_saves) AS away_saves, SUM(away_substitutions) AS away_substitutions, SUM(away_goal_attempts) AS away_goal_attempts, SUM(away_ball_safe) AS away_ball_safe, SUM(away_goals) AS away_goals, SUM(away_tackles) AS away_tackles, SUM(away_injuries) AS away_injuries, SUM(away_goal_kick) AS away_goal_kick, SUM(away_free_kick) AS away_free_kick, SUM(away_throw_in) AS away_throw_in, SUM(away_penalties) AS away_penalties, SUM(away_redcards) AS away_redcards, SUM(away_yellowredcards) AS away_yellowredcards,
SUM(away_against_stats_games) AS away_against_stats_games, SUM(away_against_shots_total) AS away_against_shots_total, SUM(away_against_shots_ongoal) AS away_against_shots_ongoal, SUM(away_against_shots_blocked) AS away_against_shots_blocked, SUM(away_against_shots_offgoal) AS away_against_shots_offgoal, SUM(away_against_shots_insidebox) AS away_against_shots_insidebox, SUM(away_against_shots_outsidebox) AS away_against_shots_outsidebox, SUM(away_against_passes_total) AS away_against_passes_total, SUM(away_against_passes_accurate) AS away_against_passes_accurate, SUM(away_against_passes_accurate)/SUM(away_against_passes_total)*100 AS away_against_passes_percentage, SUM(away_against_attacks_attacks) AS away_against_attacks_attacks, SUM(away_against_attacks_dangerous_attacks) AS away_against_attacks_dangerous_attacks, SUM(away_against_fouls) AS away_against_fouls, SUM(away_against_corners) AS away_against_corners, SUM(away_against_offsides) AS away_against_offsides, SUM(away_against_possessiontime) AS away_against_possessiontime, SUM(away_against_yellowcards) AS away_against_yellowcards, SUM(away_against_saves) AS away_against_saves, SUM(away_against_substitutions) AS away_against_substitutions, SUM(away_against_goal_attempts) AS away_against_goal_attempts, SUM(away_against_ball_safe) AS away_against_ball_safe, SUM(away_against_goals) AS away_against_goals, SUM(away_against_tackles) AS away_against_tackles, SUM(away_against_injuries) AS away_against_injuries, SUM(away_against_goal_kick) AS away_against_goal_kick, SUM(away_against_free_kick) AS away_against_free_kick, SUM(away_against_throw_in) AS away_against_throw_in, SUM(away_against_penalties) AS away_against_penalties, SUM(away_against_redcards) AS away_against_redcards, SUM(away_against_yellowredcards) AS away_against_yellowredcards, SUM(away_stats_games) / SUM(away_against_stats_games) AS away_strength_stats_games, SUM(away_shots_total) / SUM(away_against_shots_total) AS away_strength_shots_total, SUM(away_shots_ongoal) / SUM(away_against_shots_ongoal) AS away_strength_shots_ongoal, SUM(away_shots_blocked) / SUM(away_against_shots_blocked) AS away_strength_shots_blocked, SUM(away_shots_offgoal) / SUM(away_against_shots_offgoal) AS away_strength_shots_offgoal, SUM(away_shots_insidebox) / SUM(away_against_shots_insidebox) AS away_strength_shots_insidebox, SUM(away_shots_outsidebox) / SUM(away_against_shots_outsidebox) AS away_strength_shots_outsidebox, SUM(away_passes_total) / SUM(away_against_passes_total) AS away_strength_passes_total, SUM(away_passes_accurate) / SUM(away_against_passes_accurate) AS away_strength_passes_accurate, (SUM(away_passes_accurate)/SUM(away_passes_total)*100) / (SUM(away_against_passes_accurate)/SUM(away_against_passes_total)*100) AS away_strength_passes_percentage, SUM(away_attacks_attacks) / SUM(away_against_attacks_attacks) AS away_strength_attacks_attacks, SUM(away_attacks_dangerous_attacks) / SUM(away_against_attacks_dangerous_attacks) AS away_strength_attacks_dangerous_attacks, SUM(away_fouls) / SUM(away_against_fouls) AS away_strength_fouls, SUM(away_corners) / SUM(away_against_corners) AS away_strength_corners, SUM(away_offsides) / SUM(away_against_offsides) AS away_strength_offsides, SUM(away_possessiontime) / SUM(away_against_possessiontime) AS away_strength_possessiontime, SUM(away_yellowcards) / SUM(away_against_yellowcards) AS away_strength_yellowcards, SUM(away_saves) / SUM(away_against_saves) AS away_strength_saves, SUM(away_substitutions) / SUM(away_against_substitutions) AS away_strength_substitutions, SUM(away_goal_attempts) / SUM(away_against_goal_attempts) AS away_strength_goal_attempts, SUM(away_ball_safe) / SUM(away_against_ball_safe) AS away_strength_ball_safe, SUM(away_goals) / SUM(away_against_goals) AS away_strength_goals, SUM(away_tackles) / SUM(away_against_tackles) AS away_strength_tackles, SUM(away_injuries) / SUM(away_against_injuries) AS away_strength_injuries, SUM(away_goal_kick) / SUM(away_against_goal_kick) AS away_strength_goal_kick, SUM(away_free_kick) / SUM(away_against_free_kick) AS away_strength_free_kick, SUM(away_throw_in) / SUM(away_against_throw_in) AS away_strength_throw_in, SUM(away_penalties) / SUM(away_against_penalties) AS away_strength_penalties, SUM(away_redcards) / SUM(away_against_redcards) AS away_strength_redcards, SUM(away_yellowredcards) / SUM(away_against_yellowredcards) AS away_strength_yellowredcards, ((SUM(away_shots_total) / 1) / (SUM(away_against_shots_total) / 1) * 1 + (SUM(away_shots_ongoal) / 1) / (SUM(away_against_shots_ongoal) / 1) * 1 + (SUM(away_shots_insidebox) / 1) / (SUM(away_against_shots_insidebox) / 1) * 1 + (SUM(away_passes_accurate) / 1) / (SUM(away_against_passes_accurate) / 1) * 1 + (SUM(away_attacks_attacks) / 1) / (SUM(away_against_attacks_attacks) / 1) * 1 + (SUM(away_attacks_dangerous_attacks) / 1) / (SUM(away_against_attacks_dangerous_attacks) / 1) * 1 + (SUM(away_corners) / 1) / (SUM(away_against_corners) / 1) * 1 + (SUM(away_possessiontime) / 1) / (SUM(away_against_possessiontime) / 1) * 1 + (SUM(away_goal_attempts) / 1) / (SUM(away_against_goal_attempts) / 1) * 1 ) / 9 AS away_strength_weighted, CAST(0 AS UNSIGNED) as stats_games_exp, CAST(0 AS UNSIGNED) as shots_total_exp, CAST(0 AS UNSIGNED) as shots_ongoal_exp, CAST(0 AS UNSIGNED) as shots_blocked_exp, CAST(0 AS UNSIGNED) as shots_offgoal_exp, CAST(0 AS UNSIGNED) as shots_insidebox_exp, CAST(0 AS UNSIGNED) as shots_outsidebox_exp, CAST(0 AS UNSIGNED) as passes_total_exp, CAST(0 AS UNSIGNED) as passes_accurate_exp, CAST(0 AS UNSIGNED) as passes_percentage_exp, CAST(0 AS UNSIGNED) as attacks_attacks_exp, CAST(0 AS UNSIGNED) as attacks_dangerous_attacks_exp, CAST(0 AS UNSIGNED) as fouls_exp, CAST(0 AS UNSIGNED) as corners_exp, CAST(0 AS UNSIGNED) as offsides_exp, CAST(0 AS UNSIGNED) as possessiontime_exp, CAST(0 AS UNSIGNED) as yellowcards_exp, CAST(0 AS UNSIGNED) as saves_exp, CAST(0 AS UNSIGNED) as substitutions_exp, CAST(0 AS UNSIGNED) as goal_attempts_exp, CAST(0 AS UNSIGNED) as ball_safe_exp, CAST(0 AS UNSIGNED) as goals_exp, CAST(0 AS UNSIGNED) as tackles_exp, CAST(0 AS UNSIGNED) as injuries_exp, CAST(0 AS UNSIGNED) as goal_kick_exp, CAST(0 AS UNSIGNED) as free_kick_exp, CAST(0 AS UNSIGNED) as throw_in_exp, CAST(0 AS UNSIGNED) as penalties_exp, CAST(0 AS UNSIGNED) as redcards_exp, CAST(0 AS UNSIGNED) as yellowredcards_exp,
CAST(0 AS UNSIGNED) as against_stats_games_exp, CAST(0 AS UNSIGNED) as against_shots_total_exp, CAST(0 AS UNSIGNED) as against_shots_ongoal_exp, CAST(0 AS UNSIGNED) as against_shots_blocked_exp, CAST(0 AS UNSIGNED) as against_shots_offgoal_exp, CAST(0 AS UNSIGNED) as against_shots_insidebox_exp, CAST(0 AS UNSIGNED) as against_shots_outsidebox_exp, CAST(0 AS UNSIGNED) as against_passes_total_exp, CAST(0 AS UNSIGNED) as against_passes_accurate_exp, CAST(0 AS UNSIGNED) as against_passes_percentage_exp, CAST(0 AS UNSIGNED) as against_attacks_attacks_exp, CAST(0 AS UNSIGNED) as against_attacks_dangerous_attacks_exp, CAST(0 AS UNSIGNED) as against_fouls_exp, CAST(0 AS UNSIGNED) as against_corners_exp, CAST(0 AS UNSIGNED) as against_offsides_exp, CAST(0 AS UNSIGNED) as against_possessiontime_exp, CAST(0 AS UNSIGNED) as against_yellowcards_exp, CAST(0 AS UNSIGNED) as against_saves_exp, CAST(0 AS UNSIGNED) as against_substitutions_exp, CAST(0 AS UNSIGNED) as against_goal_attempts_exp, CAST(0 AS UNSIGNED) as against_ball_safe_exp, CAST(0 AS UNSIGNED) as against_goals_exp, CAST(0 AS UNSIGNED) as against_tackles_exp, CAST(0 AS UNSIGNED) as against_injuries_exp, CAST(0 AS UNSIGNED) as against_goal_kick_exp, CAST(0 AS UNSIGNED) as against_free_kick_exp, CAST(0 AS UNSIGNED) as against_throw_in_exp, CAST(0 AS UNSIGNED) as against_penalties_exp, CAST(0 AS UNSIGNED) as against_redcards_exp, CAST(0 AS UNSIGNED) as against_yellowredcards_exp, CAST(0 AS UNSIGNED) as strength_stats_games_exp, CAST(0 AS UNSIGNED) as strength_shots_total_exp, CAST(0 AS UNSIGNED) as strength_shots_ongoal_exp, CAST(0 AS UNSIGNED) as strength_shots_blocked_exp, CAST(0 AS UNSIGNED) as strength_shots_offgoal_exp, CAST(0 AS UNSIGNED) as strength_shots_insidebox_exp, CAST(0 AS UNSIGNED) as strength_shots_outsidebox_exp, CAST(0 AS UNSIGNED) as strength_passes_total_exp, CAST(0 AS UNSIGNED) as strength_passes_accurate_exp, CAST(0 AS UNSIGNED) as strength_passes_percentage_exp, CAST(0 AS UNSIGNED) as strength_attacks_attacks_exp, CAST(0 AS UNSIGNED) as strength_attacks_dangerous_attacks_exp, CAST(0 AS UNSIGNED) as strength_fouls_exp, CAST(0 AS UNSIGNED) as strength_corners_exp, CAST(0 AS UNSIGNED) as strength_offsides_exp, CAST(0 AS UNSIGNED) as strength_possessiontime_exp, CAST(0 AS UNSIGNED) as strength_yellowcards_exp, CAST(0 AS UNSIGNED) as strength_saves_exp, CAST(0 AS UNSIGNED) as strength_substitutions_exp, CAST(0 AS UNSIGNED) as strength_goal_attempts_exp, CAST(0 AS UNSIGNED) as strength_ball_safe_exp, CAST(0 AS UNSIGNED) as strength_goals_exp, CAST(0 AS UNSIGNED) as strength_tackles_exp, CAST(0 AS UNSIGNED) as strength_injuries_exp, CAST(0 AS UNSIGNED) as strength_goal_kick_exp, CAST(0 AS UNSIGNED) as strength_free_kick_exp, CAST(0 AS UNSIGNED) as strength_throw_in_exp, CAST(0 AS UNSIGNED) as strength_penalties_exp, CAST(0 AS UNSIGNED) as strength_redcards_exp, CAST(0 AS UNSIGNED) as strength_yellowredcards_exp, CAST(0 AS UNSIGNED) as strength_weighted_exp, CAST(0 AS UNSIGNED) as home_stats_games_exp, CAST(0 AS UNSIGNED) as home_shots_total_exp, CAST(0 AS UNSIGNED) as home_shots_ongoal_exp, CAST(0 AS UNSIGNED) as home_shots_blocked_exp, CAST(0 AS UNSIGNED) as home_shots_offgoal_exp, CAST(0 AS UNSIGNED) as home_shots_insidebox_exp, CAST(0 AS UNSIGNED) as home_shots_outsidebox_exp, CAST(0 AS UNSIGNED) as home_passes_total_exp, CAST(0 AS UNSIGNED) as home_passes_accurate_exp, CAST(0 AS UNSIGNED) as home_passes_percentage_exp, CAST(0 AS UNSIGNED) as home_attacks_attacks_exp, CAST(0 AS UNSIGNED) as home_attacks_dangerous_attacks_exp, CAST(0 AS UNSIGNED) as home_fouls_exp, CAST(0 AS UNSIGNED) as home_corners_exp, CAST(0 AS UNSIGNED) as home_offsides_exp, CAST(0 AS UNSIGNED) as home_possessiontime_exp, CAST(0 AS UNSIGNED) as home_yellowcards_exp, CAST(0 AS UNSIGNED) as home_saves_exp, CAST(0 AS UNSIGNED) as home_substitutions_exp, CAST(0 AS UNSIGNED) as home_goal_attempts_exp, CAST(0 AS UNSIGNED) as home_ball_safe_exp, CAST(0 AS UNSIGNED) as home_goals_exp, CAST(0 AS UNSIGNED) as home_tackles_exp, CAST(0 AS UNSIGNED) as home_injuries_exp, CAST(0 AS UNSIGNED) as home_goal_kick_exp, CAST(0 AS UNSIGNED) as home_free_kick_exp, CAST(0 AS UNSIGNED) as home_throw_in_exp, CAST(0 AS UNSIGNED) as home_penalties_exp, CAST(0 AS UNSIGNED) as home_redcards_exp, CAST(0 AS UNSIGNED) as home_yellowredcards_exp,
CAST(0 AS UNSIGNED) as home_against_stats_games_exp, CAST(0 AS UNSIGNED) as home_against_shots_total_exp, CAST(0 AS UNSIGNED) as home_against_shots_ongoal_exp, CAST(0 AS UNSIGNED) as home_against_shots_blocked_exp, CAST(0 AS UNSIGNED) as home_against_shots_offgoal_exp, CAST(0 AS UNSIGNED) as home_against_shots_insidebox_exp, CAST(0 AS UNSIGNED) as home_against_shots_outsidebox_exp, CAST(0 AS UNSIGNED) as home_against_passes_total_exp, CAST(0 AS UNSIGNED) as home_against_passes_accurate_exp, CAST(0 AS UNSIGNED) as home_against_passes_percentage_exp, CAST(0 AS UNSIGNED) as home_against_attacks_attacks_exp, CAST(0 AS UNSIGNED) as home_against_attacks_dangerous_attacks_exp, CAST(0 AS UNSIGNED) as home_against_fouls_exp, CAST(0 AS UNSIGNED) as home_against_corners_exp, CAST(0 AS UNSIGNED) as home_against_offsides_exp, CAST(0 AS UNSIGNED) as home_against_possessiontime_exp, CAST(0 AS UNSIGNED) as home_against_yellowcards_exp, CAST(0 AS UNSIGNED) as home_against_saves_exp, CAST(0 AS UNSIGNED) as home_against_substitutions_exp, CAST(0 AS UNSIGNED) as home_against_goal_attempts_exp, CAST(0 AS UNSIGNED) as home_against_ball_safe_exp, CAST(0 AS UNSIGNED) as home_against_goals_exp, CAST(0 AS UNSIGNED) as home_against_tackles_exp, CAST(0 AS UNSIGNED) as home_against_injuries_exp, CAST(0 AS UNSIGNED) as home_against_goal_kick_exp, CAST(0 AS UNSIGNED) as home_against_free_kick_exp, CAST(0 AS UNSIGNED) as home_against_throw_in_exp, CAST(0 AS UNSIGNED) as home_against_penalties_exp, CAST(0 AS UNSIGNED) as home_against_redcards_exp, CAST(0 AS UNSIGNED) as home_against_yellowredcards_exp, CAST(0 AS UNSIGNED) as home_strength_stats_games_exp, CAST(0 AS UNSIGNED) as home_strength_shots_total_exp, CAST(0 AS UNSIGNED) as home_strength_shots_ongoal_exp, CAST(0 AS UNSIGNED) as home_strength_shots_blocked_exp, CAST(0 AS UNSIGNED) as home_strength_shots_offgoal_exp, CAST(0 AS UNSIGNED) as home_strength_shots_insidebox_exp, CAST(0 AS UNSIGNED) as home_strength_shots_outsidebox_exp, CAST(0 AS UNSIGNED) as home_strength_passes_total_exp, CAST(0 AS UNSIGNED) as home_strength_passes_accurate_exp, CAST(0 AS UNSIGNED) as home_strength_passes_percentage_exp, CAST(0 AS UNSIGNED) as home_strength_attacks_attacks_exp, CAST(0 AS UNSIGNED) as home_strength_attacks_dangerous_attacks_exp, CAST(0 AS UNSIGNED) as home_strength_fouls_exp, CAST(0 AS UNSIGNED) as home_strength_corners_exp, CAST(0 AS UNSIGNED) as home_strength_offsides_exp, CAST(0 AS UNSIGNED) as home_strength_possessiontime_exp, CAST(0 AS UNSIGNED) as home_strength_yellowcards_exp, CAST(0 AS UNSIGNED) as home_strength_saves_exp, CAST(0 AS UNSIGNED) as home_strength_substitutions_exp, CAST(0 AS UNSIGNED) as home_strength_goal_attempts_exp, CAST(0 AS UNSIGNED) as home_strength_ball_safe_exp, CAST(0 AS UNSIGNED) as home_strength_goals_exp, CAST(0 AS UNSIGNED) as home_strength_tackles_exp, CAST(0 AS UNSIGNED) as home_strength_injuries_exp, CAST(0 AS UNSIGNED) as home_strength_goal_kick_exp, CAST(0 AS UNSIGNED) as home_strength_free_kick_exp, CAST(0 AS UNSIGNED) as home_strength_throw_in_exp, CAST(0 AS UNSIGNED) as home_strength_penalties_exp, CAST(0 AS UNSIGNED) as home_strength_redcards_exp, CAST(0 AS UNSIGNED) as home_strength_yellowredcards_exp, CAST(0 AS UNSIGNED) as away_stats_games_exp, CAST(0 AS UNSIGNED) as away_shots_total_exp, CAST(0 AS UNSIGNED) as away_shots_ongoal_exp, CAST(0 AS UNSIGNED) as away_shots_blocked_exp, CAST(0 AS UNSIGNED) as away_shots_offgoal_exp, CAST(0 AS UNSIGNED) as away_shots_insidebox_exp, CAST(0 AS UNSIGNED) as away_shots_outsidebox_exp, CAST(0 AS UNSIGNED) as away_passes_total_exp, CAST(0 AS UNSIGNED) as away_passes_accurate_exp, CAST(0 AS UNSIGNED) as away_passes_percentage_exp, CAST(0 AS UNSIGNED) as away_attacks_attacks_exp, CAST(0 AS UNSIGNED) as away_attacks_dangerous_attacks_exp, CAST(0 AS UNSIGNED) as away_fouls_exp, CAST(0 AS UNSIGNED) as away_corners_exp, CAST(0 AS UNSIGNED) as away_offsides_exp, CAST(0 AS UNSIGNED) as away_possessiontime_exp, CAST(0 AS UNSIGNED) as away_yellowcards_exp, CAST(0 AS UNSIGNED) as away_saves_exp, CAST(0 AS UNSIGNED) as away_substitutions_exp, CAST(0 AS UNSIGNED) as away_goal_attempts_exp, CAST(0 AS UNSIGNED) as away_ball_safe_exp, CAST(0 AS UNSIGNED) as away_goals_exp, CAST(0 AS UNSIGNED) as away_tackles_exp, CAST(0 AS UNSIGNED) as away_injuries_exp, CAST(0 AS UNSIGNED) as away_goal_kick_exp, CAST(0 AS UNSIGNED) as away_free_kick_exp, CAST(0 AS UNSIGNED) as away_throw_in_exp, CAST(0 AS UNSIGNED) as away_penalties_exp, CAST(0 AS UNSIGNED) as away_redcards_exp, CAST(0 AS UNSIGNED) as away_yellowredcards_exp,
CAST(0 AS UNSIGNED) as away_against_stats_games_exp, CAST(0 AS UNSIGNED) as away_against_shots_total_exp, CAST(0 AS UNSIGNED) as away_against_shots_ongoal_exp, CAST(0 AS UNSIGNED) as away_against_shots_blocked_exp, CAST(0 AS UNSIGNED) as away_against_shots_offgoal_exp, CAST(0 AS UNSIGNED) as away_against_shots_insidebox_exp, CAST(0 AS UNSIGNED) as away_against_shots_outsidebox_exp, CAST(0 AS UNSIGNED) as away_against_passes_total_exp, CAST(0 AS UNSIGNED) as away_against_passes_accurate_exp, CAST(0 AS UNSIGNED) as away_against_passes_percentage_exp, CAST(0 AS UNSIGNED) as away_against_attacks_attacks_exp, CAST(0 AS UNSIGNED) as away_against_attacks_dangerous_attacks_exp, CAST(0 AS UNSIGNED) as away_against_fouls_exp, CAST(0 AS UNSIGNED) as away_against_corners_exp, CAST(0 AS UNSIGNED) as away_against_offsides_exp, CAST(0 AS UNSIGNED) as away_against_possessiontime_exp, CAST(0 AS UNSIGNED) as away_against_yellowcards_exp, CAST(0 AS UNSIGNED) as away_against_saves_exp, CAST(0 AS UNSIGNED) as away_against_substitutions_exp, CAST(0 AS UNSIGNED) as away_against_goal_attempts_exp, CAST(0 AS UNSIGNED) as away_against_ball_safe_exp, CAST(0 AS UNSIGNED) as away_against_goals_exp, CAST(0 AS UNSIGNED) as away_against_tackles_exp, CAST(0 AS UNSIGNED) as away_against_injuries_exp, CAST(0 AS UNSIGNED) as away_against_goal_kick_exp, CAST(0 AS UNSIGNED) as away_against_free_kick_exp, CAST(0 AS UNSIGNED) as away_against_throw_in_exp, CAST(0 AS UNSIGNED) as away_against_penalties_exp, CAST(0 AS UNSIGNED) as away_against_redcards_exp, CAST(0 AS UNSIGNED) as away_against_yellowredcards_exp, CAST(0 AS UNSIGNED) as away_strength_stats_games_exp, CAST(0 AS UNSIGNED) as away_strength_shots_total_exp, CAST(0 AS UNSIGNED) as away_strength_shots_ongoal_exp, CAST(0 AS UNSIGNED) as away_strength_shots_blocked_exp, CAST(0 AS UNSIGNED) as away_strength_shots_offgoal_exp, CAST(0 AS UNSIGNED) as away_strength_shots_insidebox_exp, CAST(0 AS UNSIGNED) as away_strength_shots_outsidebox_exp, CAST(0 AS UNSIGNED) as away_strength_passes_total_exp, CAST(0 AS UNSIGNED) as away_strength_passes_accurate_exp, CAST(0 AS UNSIGNED) as away_strength_passes_percentage_exp, CAST(0 AS UNSIGNED) as away_strength_attacks_attacks_exp, CAST(0 AS UNSIGNED) as away_strength_attacks_dangerous_attacks_exp, CAST(0 AS UNSIGNED) as away_strength_fouls_exp, CAST(0 AS UNSIGNED) as away_strength_corners_exp, CAST(0 AS UNSIGNED) as away_strength_offsides_exp, CAST(0 AS UNSIGNED) as away_strength_possessiontime_exp, CAST(0 AS UNSIGNED) as away_strength_yellowcards_exp, CAST(0 AS UNSIGNED) as away_strength_saves_exp, CAST(0 AS UNSIGNED) as away_strength_substitutions_exp, CAST(0 AS UNSIGNED) as away_strength_goal_attempts_exp, CAST(0 AS UNSIGNED) as away_strength_ball_safe_exp, CAST(0 AS UNSIGNED) as away_strength_goals_exp, CAST(0 AS UNSIGNED) as away_strength_tackles_exp, CAST(0 AS UNSIGNED) as away_strength_injuries_exp, CAST(0 AS UNSIGNED) as away_strength_goal_kick_exp, CAST(0 AS UNSIGNED) as away_strength_free_kick_exp, CAST(0 AS UNSIGNED) as away_strength_throw_in_exp, CAST(0 AS UNSIGNED) as away_strength_penalties_exp, CAST(0 AS UNSIGNED) as away_strength_redcards_exp, CAST(0 AS UNSIGNED) as away_strength_yellowredcards_exp
FROM (
(SELECT f.id, f.time_starting_at_date_time, f.time_starting_at_timezone, f.time_starting_at_timestamp, 'Home' as homworaway, f.league_id, f.season_id, f.stage_id, f.round_id, IF(sst.group_id IS NULL, f.group_id, sst.group_id) as group_id, f.localteam_id as team_id, f.visitorteam_id as team2_id, st.name as stage_name, IF(sst.group_name IS NULL, g.name, sst.group_name) as group_name,
1 as overall_games_played, IF(scores_localteam_score>scores_visitorteam_score,1,0) overall_won, IF(scores_localteam_score=scores_visitorteam_score,1,0) overall_draw, IF(scores_localteam_score<scores_visitorteam_score,1,0) overall_lost, scores_localteam_score overall_goals_scored, scores_visitorteam_score overall_goals_against,
1 as home_games_played, IF(scores_localteam_score>scores_visitorteam_score,1,0) home_won, IF(scores_localteam_score=scores_visitorteam_score,1,0) home_draw, IF(scores_localteam_score<scores_visitorteam_score,1,0) home_lost, scores_localteam_score home_goals_scored, scores_visitorteam_score home_goals_against,
0 as away_games_played, 0 away_won, 0 away_draw, 0 away_lost, 0 away_goals_scored, 0 away_goals_against,
scores_localteam_score-scores_visitorteam_score AS total_goal_difference,
CASE
WHEN scores_localteam_score>scores_visitorteam_score THEN 3
WHEN scores_localteam_score=scores_visitorteam_score THEN 1
WHEN scores_localteam_score<scores_visitorteam_score THEN 0
END points,
CASE
WHEN scores_localteam_score>scores_visitorteam_score THEN 3
WHEN scores_localteam_score=scores_visitorteam_score THEN 1
WHEN scores_localteam_score<scores_visitorteam_score THEN 0
END home_points,
0 away_points,


IF(fs.scenario_id IS NULL,0,1) as overall_games_played_exp, fs.win_prob/100 overall_won_exp, fs.draw_prob/100 overall_draw_exp, fs.loss_prob/100 overall_lost_exp, fs.goal_exp_simulated_team1 overall_goals_scored_exp, fs.goal_exp_simulated_team2 overall_goals_against_exp,
IF(fs.scenario_id IS NULL,0,1) as home_games_played_exp, fs.win_prob/100 home_won_exp, fs.draw_prob/100 home_draw_exp, fs.loss_prob/100 home_lost_exp, fs.goal_exp_simulated_team1 home_goals_scored_exp, fs.goal_exp_simulated_team2 home_goals_against_exp,
0 as away_games_played_exp, 0 away_won_exp, 0 away_draw_exp, 0 away_lost_exp, 0 away_goals_scored_exp, 0 away_goals_against_exp,
fs.goal_exp_simulated_team1-fs.goal_exp_simulated_team2 AS total_goal_difference_exp,
fs.win_prob/100*3+fs.draw_prob/100*1+fs.loss_prob/100*0 points_exp, fs.win_prob/100*3+fs.draw_prob/100*1+fs.loss_prob/100*0 home_points_exp, 0 away_points_exp,IF(s.fixture_id IS NULL,0,1) as stats_games, s.shots_total as shots_total, s.shots_ongoal as shots_ongoal, s.shots_blocked as shots_blocked, s.shots_offgoal as shots_offgoal, s.shots_insidebox as shots_insidebox, s.shots_outsidebox as shots_outsidebox, s.passes_total as passes_total, s.passes_accurate as passes_accurate, s.passes_percentage as passes_percentage, s.attacks_attacks as attacks_attacks, s.attacks_dangerous_attacks as attacks_dangerous_attacks, s.fouls as fouls, s.corners as corners, s.offsides as offsides, s.possessiontime as possessiontime, s.yellowcards as yellowcards, s.saves as saves, s.substitutions as substitutions, s.goal_attempts as goal_attempts, s.ball_safe as ball_safe, s.goals as goals, s.tackles as tackles, s.injuries as injuries, s.goal_kick as goal_kick, s.free_kick as free_kick, s.throw_in as throw_in, s.penalties as penalties, s.redcards as redcards, s.yellowredcards as yellowredcards,
IF(sa.fixture_id IS NULL,0,1) as against_stats_games, sa.shots_total as against_shots_total, sa.shots_ongoal as against_shots_ongoal, sa.shots_blocked as against_shots_blocked, sa.shots_offgoal as against_shots_offgoal, sa.shots_insidebox as against_shots_insidebox, sa.shots_outsidebox as against_shots_outsidebox, sa.passes_total as against_passes_total, sa.passes_accurate as against_passes_accurate, sa.passes_percentage as against_passes_percentage, sa.attacks_attacks as against_attacks_attacks, sa.attacks_dangerous_attacks as against_attacks_dangerous_attacks, sa.fouls as against_fouls, sa.corners as against_corners, sa.offsides as against_offsides, sa.possessiontime as against_possessiontime, sa.yellowcards as against_yellowcards, sa.saves as against_saves, sa.substitutions as against_substitutions, sa.goal_attempts as against_goal_attempts, sa.ball_safe as against_ball_safe, sa.goals as against_goals, sa.tackles as against_tackles, sa.injuries as against_injuries, sa.goal_kick as against_goal_kick, sa.free_kick as against_free_kick, sa.throw_in as against_throw_in, sa.penalties as against_penalties, sa.redcards as against_redcards, sa.yellowredcards as against_yellowredcards,
IF(s.fixture_id IS NULL,0,1) as home_stats_games, s.shots_total as home_shots_total, s.shots_ongoal as home_shots_ongoal, s.shots_blocked as home_shots_blocked, s.shots_offgoal as home_shots_offgoal, s.shots_insidebox as home_shots_insidebox, s.shots_outsidebox as home_shots_outsidebox, s.passes_total as home_passes_total, s.passes_accurate as home_passes_accurate, s.passes_percentage as home_passes_percentage, s.attacks_attacks as home_attacks_attacks, s.attacks_dangerous_attacks as home_attacks_dangerous_attacks, s.fouls as home_fouls, s.corners as home_corners, s.offsides as home_offsides, s.possessiontime as home_possessiontime, s.yellowcards as home_yellowcards, s.saves as home_saves, s.substitutions as home_substitutions, s.goal_attempts as home_goal_attempts, s.ball_safe as home_ball_safe, s.goals as home_goals, s.tackles as home_tackles, s.injuries as home_injuries, s.goal_kick as home_goal_kick, s.free_kick as home_free_kick, s.throw_in as home_throw_in, s.penalties as home_penalties, s.redcards as home_redcards, s.yellowredcards as home_yellowredcards,
IF(sa.fixture_id IS NULL,0,1) as home_against_stats_games, sa.shots_total as home_against_shots_total, sa.shots_ongoal as home_against_shots_ongoal, sa.shots_blocked as home_against_shots_blocked, sa.shots_offgoal as home_against_shots_offgoal, sa.shots_insidebox as home_against_shots_insidebox, sa.shots_outsidebox as home_against_shots_outsidebox, sa.passes_total as home_against_passes_total, sa.passes_accurate as home_against_passes_accurate, sa.passes_percentage as home_against_passes_percentage, sa.attacks_attacks as home_against_attacks_attacks, sa.attacks_dangerous_attacks as home_against_attacks_dangerous_attacks, sa.fouls as home_against_fouls, sa.corners as home_against_corners, sa.offsides as home_against_offsides, sa.possessiontime as home_against_possessiontime, sa.yellowcards as home_against_yellowcards, sa.saves as home_against_saves, sa.substitutions as home_against_substitutions, sa.goal_attempts as home_against_goal_attempts, sa.ball_safe as home_against_ball_safe, sa.goals as home_against_goals, sa.tackles as home_against_tackles, sa.injuries as home_against_injuries, sa.goal_kick as home_against_goal_kick, sa.free_kick as home_against_free_kick, sa.throw_in as home_against_throw_in, sa.penalties as home_against_penalties, sa.redcards as home_against_redcards, sa.yellowredcards as home_against_yellowredcards,
CAST(0 AS UNSIGNED) as away_stats_games, CAST(0 AS UNSIGNED) as away_shots_total, CAST(0 AS UNSIGNED) as away_shots_ongoal, CAST(0 AS UNSIGNED) as away_shots_blocked, CAST(0 AS UNSIGNED) as away_shots_offgoal, CAST(0 AS UNSIGNED) as away_shots_insidebox, CAST(0 AS UNSIGNED) as away_shots_outsidebox, CAST(0 AS UNSIGNED) as away_passes_total, CAST(0 AS UNSIGNED) as away_passes_accurate, CAST(0 AS UNSIGNED) as away_passes_percentage, CAST(0 AS UNSIGNED) as away_attacks_attacks, CAST(0 AS UNSIGNED) as away_attacks_dangerous_attacks, CAST(0 AS UNSIGNED) as away_fouls, CAST(0 AS UNSIGNED) as away_corners, CAST(0 AS UNSIGNED) as away_offsides, CAST(0 AS UNSIGNED) as away_possessiontime, CAST(0 AS UNSIGNED) as away_yellowcards, CAST(0 AS UNSIGNED) as away_saves, CAST(0 AS UNSIGNED) as away_substitutions, CAST(0 AS UNSIGNED) as away_goal_attempts, CAST(0 AS UNSIGNED) as away_ball_safe, CAST(0 AS UNSIGNED) as away_goals, CAST(0 AS UNSIGNED) as away_tackles, CAST(0 AS UNSIGNED) as away_injuries, CAST(0 AS UNSIGNED) as away_goal_kick, CAST(0 AS UNSIGNED) as away_free_kick, CAST(0 AS UNSIGNED) as away_throw_in, CAST(0 AS UNSIGNED) as away_penalties, CAST(0 AS UNSIGNED) as away_redcards, CAST(0 AS UNSIGNED) as away_yellowredcards,
CAST(0 AS UNSIGNED) as away_against_stats_games, CAST(0 AS UNSIGNED) as away_against_shots_total, CAST(0 AS UNSIGNED) as away_against_shots_ongoal, CAST(0 AS UNSIGNED) as away_against_shots_blocked, CAST(0 AS UNSIGNED) as away_against_shots_offgoal, CAST(0 AS UNSIGNED) as away_against_shots_insidebox, CAST(0 AS UNSIGNED) as away_against_shots_outsidebox, CAST(0 AS UNSIGNED) as away_against_passes_total, CAST(0 AS UNSIGNED) as away_against_passes_accurate, CAST(0 AS UNSIGNED) as away_against_passes_percentage, CAST(0 AS UNSIGNED) as away_against_attacks_attacks, CAST(0 AS UNSIGNED) as away_against_attacks_dangerous_attacks, CAST(0 AS UNSIGNED) as away_against_fouls, CAST(0 AS UNSIGNED) as away_against_corners, CAST(0 AS UNSIGNED) as away_against_offsides, CAST(0 AS UNSIGNED) as away_against_possessiontime, CAST(0 AS UNSIGNED) as away_against_yellowcards, CAST(0 AS UNSIGNED) as away_against_saves, CAST(0 AS UNSIGNED) as away_against_substitutions, CAST(0 AS UNSIGNED) as away_against_goal_attempts, CAST(0 AS UNSIGNED) as away_against_ball_safe, CAST(0 AS UNSIGNED) as away_against_goals, CAST(0 AS UNSIGNED) as away_against_tackles, CAST(0 AS UNSIGNED) as away_against_injuries, CAST(0 AS UNSIGNED) as away_against_goal_kick, CAST(0 AS UNSIGNED) as away_against_free_kick, CAST(0 AS UNSIGNED) as away_against_throw_in, CAST(0 AS UNSIGNED) as away_against_penalties, CAST(0 AS UNSIGNED) as away_against_redcards, CAST(0 AS UNSIGNED) as away_against_yellowredcards
FROM `sm_fixtures` f
LEFT JOIN `sm_fixtures_scenariodata` fs ON f.id=fs.fixture_id AND (fs.scenario_id=549 OR fs.scenario_id IS NULL)
LEFT JOIN `sm_stages` st ON st.id=f.stage_id
LEFT JOIN `sm_groups` g ON g.id=f.group_id
LEFT JOIN `sm_stats` s ON s.fixture_id=f.id AND s.team_id=f.localteam_id
LEFT JOIN `sm_stats` sa ON sa.fixture_id=f.id AND sa.team_id=f.visitorteam_id
LEFT JOIN `sm_season_stage_team_group` sst ON sst.season_id=f.season_id AND sst.stage_id=f.stage_id AND sst.team_id=f.localteam_id
WHERE f.`season_id` = 22807 AND time_starting_at_date_time<='9999-99-99 99:99:99' AND f.time_status IN ('FT','AET','FT_PEN','AWARDED','WO') ORDER BY `time_starting_at_date_time` ASC)

UNION ALL

(SELECT f.id, f.time_starting_at_date_time, f.time_starting_at_timezone, f.time_starting_at_timestamp, 'Away' as homworaway, f.league_id, f.season_id, f.stage_id, f.round_id, IF(sst.group_id IS NULL, f.group_id, sst.group_id) as group_id, f.visitorteam_id as team_id, f.localteam_id as team2_id, st.name as stage_name, IF(sst.group_name IS NULL, g.name, sst.group_name) as group_name,
1 as overall_games_played, IF(scores_localteam_score<scores_visitorteam_score,1,0) overall_won, IF(scores_localteam_score=scores_visitorteam_score,1,0) overall_draw, IF(scores_localteam_score>scores_visitorteam_score,1,0) overall_lost, scores_visitorteam_score overall_goals_scored, scores_localteam_score overall_goals_against,
0 as home_games_played, 0 home_won, 0 home_draw, 0 home_lost, 0 home_goals_scored, 0 home_goals_against,
1 as away_games_played, IF(scores_localteam_score<scores_visitorteam_score,1,0) away_won, IF(scores_localteam_score=scores_visitorteam_score,1,0) away_draw, IF(scores_localteam_score>scores_visitorteam_score,1,0) away_lost, scores_visitorteam_score away_goals_scored, scores_localteam_score away_goals_against,
scores_visitorteam_score-scores_localteam_score AS total_goal_difference,
CASE
WHEN scores_localteam_score<scores_visitorteam_score THEN 3
WHEN scores_localteam_score=scores_visitorteam_score THEN 1
WHEN scores_localteam_score>scores_visitorteam_score THEN 0
END points,
0 AS home_points,
CASE
WHEN scores_localteam_score<scores_visitorteam_score THEN 3
WHEN scores_localteam_score=scores_visitorteam_score THEN 1
WHEN scores_localteam_score>scores_visitorteam_score THEN 0
END away_points,


IF(fs.scenario_id IS NULL,0,1) as overall_games_played_exp, fs.loss_prob/100 overall_won_exp, fs.draw_prob/100 overall_draw_exp, fs.win_prob/100 overall_lost_exp, fs.goal_exp_simulated_team2 overall_goals_scored_exp, fs.goal_exp_simulated_team1 overall_goals_against_exp,
0 as home_games_played_exp, 0 home_won_exp, 0 home_draw_exp, 0 home_lost_exp, 0 home_goals_scored_exp, 0 home_goals_against_exp,
IF(fs.scenario_id IS NULL,0,1) as away_games_played_exp, fs.loss_prob/100 away_won_exp, fs.draw_prob/100 away_draw_exp, fs.win_prob/100 away_lost_exp, fs.goal_exp_simulated_team2 away_goals_scored_exp, fs.goal_exp_simulated_team1 away_goals_against_exp,
fs.goal_exp_simulated_team2-fs.goal_exp_simulated_team1 AS total_goal_difference_exp,
fs.loss_prob/100*3+fs.draw_prob/100*1+fs.win_prob/100*0 points_exp, 0 home_points_exp, fs.loss_prob/100*3+fs.draw_prob/100*1+fs.win_prob/100*0 away_points_exp,IF(s.fixture_id IS NULL,0,1) as stats_games, s.shots_total as shots_total, s.shots_ongoal as shots_ongoal, s.shots_blocked as shots_blocked, s.shots_offgoal as shots_offgoal, s.shots_insidebox as shots_insidebox, s.shots_outsidebox as shots_outsidebox, s.passes_total as passes_total, s.passes_accurate as passes_accurate, s.passes_percentage as passes_percentage, s.attacks_attacks as attacks_attacks, s.attacks_dangerous_attacks as attacks_dangerous_attacks, s.fouls as fouls, s.corners as corners, s.offsides as offsides, s.possessiontime as possessiontime, s.yellowcards as yellowcards, s.saves as saves, s.substitutions as substitutions, s.goal_attempts as goal_attempts, s.ball_safe as ball_safe, s.goals as goals, s.tackles as tackles, s.injuries as injuries, s.goal_kick as goal_kick, s.free_kick as free_kick, s.throw_in as throw_in, s.penalties as penalties, s.redcards as redcards, s.yellowredcards as yellowredcards,
IF(sa.fixture_id IS NULL,0,1) as against_stats_games, sa.shots_total as against_shots_total, sa.shots_ongoal as against_shots_ongoal, sa.shots_blocked as against_shots_blocked, sa.shots_offgoal as against_shots_offgoal, sa.shots_insidebox as against_shots_insidebox, sa.shots_outsidebox as against_shots_outsidebox, sa.passes_total as against_passes_total, sa.passes_accurate as against_passes_accurate, sa.passes_percentage as against_passes_percentage, sa.attacks_attacks as against_attacks_attacks, sa.attacks_dangerous_attacks as against_attacks_dangerous_attacks, sa.fouls as against_fouls, sa.corners as against_corners, sa.offsides as against_offsides, sa.possessiontime as against_possessiontime, sa.yellowcards as against_yellowcards, sa.saves as against_saves, sa.substitutions as against_substitutions, sa.goal_attempts as against_goal_attempts, sa.ball_safe as against_ball_safe, sa.goals as against_goals, sa.tackles as against_tackles, sa.injuries as against_injuries, sa.goal_kick as against_goal_kick, sa.free_kick as against_free_kick, sa.throw_in as against_throw_in, sa.penalties as against_penalties, sa.redcards as against_redcards, sa.yellowredcards as against_yellowredcards,
CAST(0 AS UNSIGNED) as home_stats_games, CAST(0 AS UNSIGNED) as home_shots_total, CAST(0 AS UNSIGNED) as home_shots_ongoal, CAST(0 AS UNSIGNED) as home_shots_blocked, CAST(0 AS UNSIGNED) as home_shots_offgoal, CAST(0 AS UNSIGNED) as home_shots_insidebox, CAST(0 AS UNSIGNED) as home_shots_outsidebox, CAST(0 AS UNSIGNED) as home_passes_total, CAST(0 AS UNSIGNED) as home_passes_accurate, CAST(0 AS UNSIGNED) as home_passes_percentage, CAST(0 AS UNSIGNED) as home_attacks_attacks, CAST(0 AS UNSIGNED) as home_attacks_dangerous_attacks, CAST(0 AS UNSIGNED) as home_fouls, CAST(0 AS UNSIGNED) as home_corners, CAST(0 AS UNSIGNED) as home_offsides, CAST(0 AS UNSIGNED) as home_possessiontime, CAST(0 AS UNSIGNED) as home_yellowcards, CAST(0 AS UNSIGNED) as home_saves, CAST(0 AS UNSIGNED) as home_substitutions, CAST(0 AS UNSIGNED) as home_goal_attempts, CAST(0 AS UNSIGNED) as home_ball_safe, CAST(0 AS UNSIGNED) as home_goals, CAST(0 AS UNSIGNED) as home_tackles, CAST(0 AS UNSIGNED) as home_injuries, CAST(0 AS UNSIGNED) as home_goal_kick, CAST(0 AS UNSIGNED) as home_free_kick, CAST(0 AS UNSIGNED) as home_throw_in, CAST(0 AS UNSIGNED) as home_penalties, CAST(0 AS UNSIGNED) as home_redcards, CAST(0 AS UNSIGNED) as home_yellowredcards,
CAST(0 AS UNSIGNED) as home_against_stats_games, CAST(0 AS UNSIGNED) as home_against_shots_total, CAST(0 AS UNSIGNED) as home_against_shots_ongoal, CAST(0 AS UNSIGNED) as home_against_shots_blocked, CAST(0 AS UNSIGNED) as home_against_shots_offgoal, CAST(0 AS UNSIGNED) as home_against_shots_insidebox, CAST(0 AS UNSIGNED) as home_against_shots_outsidebox, CAST(0 AS UNSIGNED) as home_against_passes_total, CAST(0 AS UNSIGNED) as home_against_passes_accurate, CAST(0 AS UNSIGNED) as home_against_passes_percentage, CAST(0 AS UNSIGNED) as home_against_attacks_attacks, CAST(0 AS UNSIGNED) as home_against_attacks_dangerous_attacks, CAST(0 AS UNSIGNED) as home_against_fouls, CAST(0 AS UNSIGNED) as home_against_corners, CAST(0 AS UNSIGNED) as home_against_offsides, CAST(0 AS UNSIGNED) as home_against_possessiontime, CAST(0 AS UNSIGNED) as home_against_yellowcards, CAST(0 AS UNSIGNED) as home_against_saves, CAST(0 AS UNSIGNED) as home_against_substitutions, CAST(0 AS UNSIGNED) as home_against_goal_attempts, CAST(0 AS UNSIGNED) as home_against_ball_safe, CAST(0 AS UNSIGNED) as home_against_goals, CAST(0 AS UNSIGNED) as home_against_tackles, CAST(0 AS UNSIGNED) as home_against_injuries, CAST(0 AS UNSIGNED) as home_against_goal_kick, CAST(0 AS UNSIGNED) as home_against_free_kick, CAST(0 AS UNSIGNED) as home_against_throw_in, CAST(0 AS UNSIGNED) as home_against_penalties, CAST(0 AS UNSIGNED) as home_against_redcards, CAST(0 AS UNSIGNED) as home_against_yellowredcards,
IF(s.fixture_id IS NULL,0,1) as away_stats_games, s.shots_total as away_shots_total, s.shots_ongoal as away_shots_ongoal, s.shots_blocked as away_shots_blocked, s.shots_offgoal as away_shots_offgoal, s.shots_insidebox as away_shots_insidebox, s.shots_outsidebox as away_shots_outsidebox, s.passes_total as away_passes_total, s.passes_accurate as away_passes_accurate, s.passes_percentage as away_passes_percentage, s.attacks_attacks as away_attacks_attacks, s.attacks_dangerous_attacks as away_attacks_dangerous_attacks, s.fouls as away_fouls, s.corners as away_corners, s.offsides as away_offsides, s.possessiontime as away_possessiontime, s.yellowcards as away_yellowcards, s.saves as away_saves, s.substitutions as away_substitutions, s.goal_attempts as away_goal_attempts, s.ball_safe as away_ball_safe, s.goals as away_goals, s.tackles as away_tackles, s.injuries as away_injuries, s.goal_kick as away_goal_kick, s.free_kick as away_free_kick, s.throw_in as away_throw_in, s.penalties as away_penalties, s.redcards as away_redcards, s.yellowredcards as away_yellowredcards,
IF(sa.fixture_id IS NULL,0,1) as away_against_stats_games, sa.shots_total as away_against_shots_total, sa.shots_ongoal as away_against_shots_ongoal, sa.shots_blocked as away_against_shots_blocked, sa.shots_offgoal as away_against_shots_offgoal, sa.shots_insidebox as away_against_shots_insidebox, sa.shots_outsidebox as away_against_shots_outsidebox, sa.passes_total as away_against_passes_total, sa.passes_accurate as away_against_passes_accurate, sa.passes_percentage as away_against_passes_percentage, sa.attacks_attacks as away_against_attacks_attacks, sa.attacks_dangerous_attacks as away_against_attacks_dangerous_attacks, sa.fouls as away_against_fouls, sa.corners as away_against_corners, sa.offsides as away_against_offsides, sa.possessiontime as away_against_possessiontime, sa.yellowcards as away_against_yellowcards, sa.saves as away_against_saves, sa.substitutions as away_against_substitutions, sa.goal_attempts as away_against_goal_attempts, sa.ball_safe as away_against_ball_safe, sa.goals as away_against_goals, sa.tackles as away_against_tackles, sa.injuries as away_against_injuries, sa.goal_kick as away_against_goal_kick, sa.free_kick as away_against_free_kick, sa.throw_in as away_against_throw_in, sa.penalties as away_against_penalties, sa.redcards as away_against_redcards, sa.yellowredcards as away_against_yellowredcards
FROM `sm_fixtures` f
LEFT JOIN `sm_fixtures_scenariodata` fs ON f.id=fs.fixture_id AND (fs.scenario_id=549 OR fs.scenario_id IS NULL)
LEFT JOIN `sm_stages` st ON st.id=f.stage_id
LEFT JOIN `sm_groups` g ON g.id=f.group_id
LEFT JOIN `sm_stats` s ON s.fixture_id=f.id AND s.team_id=f.visitorteam_id
LEFT JOIN `sm_stats` sa ON sa.fixture_id=f.id AND sa.team_id=f.localteam_id
LEFT JOIN `sm_season_stage_team_group` sst ON sst.season_id=f.season_id AND sst.stage_id=f.stage_id AND sst.team_id=f.visitorteam_id
WHERE f.`season_id` = 22807 AND time_starting_at_date_time<='9999-99-99 99:99:99' AND f.time_status IN ('FT','AET','FT_PEN','AWARDED','WO') ORDER BY `time_starting_at_date_time` ASC)
) s
JOIN sm_teams t ON t.id=s.team_id
LEFT JOIN sm_teams t2 ON t2.id=s.team2_id LEFT JOIN sm_flatOddsData_stats stat1 ON stat1.fixture_id=s.id AND stat1.label='1' AND stat1.market_id=1
LEFT JOIN sm_flatOddsData_stats statX ON statX.fixture_id=s.id AND statX.label='X' AND statX.market_id=1
LEFT JOIN sm_flatOddsData_stats stat2 ON stat2.fixture_id=s.id AND stat2.label='2' AND stat2.market_id=1 LEFT JOIN sm_fixtures_scenariodata_market fair1 ON fair1.fixture_id=s.id AND fair1.label='1' AND fair1.market_id=1 AND fair1.scenario_id=549
LEFT JOIN sm_fixtures_scenariodata_market fairX ON fairX.fixture_id=s.id AND fairX.label='X' AND fairX.market_id=1 AND fairX.scenario_id=549
LEFT JOIN sm_fixtures_scenariodata_market fair2 ON fair2.fixture_id=s.id AND fair2.label='2' AND fair2.market_id=1 AND fair2.scenario_id=549
GROUP BY league_id, season_id, stage_name, group_name, stage_id, group_id, team_id ORDER BY overall_points DESC
) sfinal WINDOW total_window AS () ORDER BY stage_name, group_name, position) tcnt

Error Info: Array
(
    [0] => HY000
    [1] => 1117
    [2] => Too many columns
)
$_GET = [
    'country_uri' => 'England',
    'league_uri' => 'FA-Cup-Women',
    'hiddenfield' => 1,
    'country_id' => '462',
    'league_id' => [
        '1506',
    ],
];

$_SESSION = [
    '__flash' => [],
    'frontendTranslation_EnableTranslate' => 1,
    'sporttype_id' => 1,
    'sporttype' => unserialize('O:21:"app\\models\\Sporttypes":10:{s:36:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_attributes";a:18:{s:2:"id";i:1;s:4:"name";s:8:"Football";s:11:"tableprefix";s:2:"sm";s:4:"icon";s:6:"futbol";s:6:"active";i:1;s:7:"hitname";s:4:"goal";s:8:"has_draw";i:1;s:15:"stats_available";i:1;s:15:"squad_available";i:1;s:15:"sm_ai_available";i:1;s:15:"game_length_min";i:90;s:7:"periods";i:2;s:15:"overtimes_count";i:0;s:19:"overtime_length_min";i:0;s:9:"penalties";i:0;s:10:"win_points";i:3;s:11:"draw_points";i:1;s:11:"loss_points";i:0;}s:39:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_oldAttributes";a:18:{s:2:"id";i:1;s:4:"name";s:8:"Football";s:11:"tableprefix";s:2:"sm";s:4:"icon";s:6:"futbol";s:6:"active";i:1;s:7:"hitname";s:4:"goal";s:8:"has_draw";i:1;s:15:"stats_available";i:1;s:15:"squad_available";i:1;s:15:"sm_ai_available";i:1;s:15:"game_length_min";i:90;s:7:"periods";i:2;s:15:"overtimes_count";i:0;s:19:"overtime_length_min";i:0;s:9:"penalties";i:0;s:10:"win_points";i:3;s:11:"draw_points";i:1;s:11:"loss_points";i:0;}s:33:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_related";a:0:{}s:47:"' . "\0" . 'yii\\db\\BaseActiveRecord' . "\0" . '_relationsDependencies";a:0:{}s:23:"' . "\0" . 'yii\\base\\Model' . "\0" . '_errors";N;s:27:"' . "\0" . 'yii\\base\\Model' . "\0" . '_validators";N;s:25:"' . "\0" . 'yii\\base\\Model' . "\0" . '_scenario";s:7:"default";s:27:"' . "\0" . 'yii\\base\\Component' . "\0" . '_events";a:0:{}s:35:"' . "\0" . 'yii\\base\\Component' . "\0" . '_eventWildcards";a:0:{}s:30:"' . "\0" . 'yii\\base\\Component' . "\0" . '_behaviors";a:0:{}}'),
    'scenario_id' => '549',
];