WordPress database error: [Incorrect DATE value: '']SELECT
t.id as TeamId,
t.name as TeamName,
t.machine_name as MachName,
lt.games_played as NumGames,
lt.games_won as NumGamesWon,
lt.games_lost as NumGamesLost,
lt.games_drawn as NumGamesDrawn,
lt.legs_for + COALESCE(SUM(ta.points), 0) as LegsFor,
lt.legs_against as LegsAgainst,
lt.legs_for - lt.legs_against as LegsAve
FROM cache_league_table_weekly lt
INNER JOIN teams t ON t.id = lt.team_id
LEFT JOIN team_amendments ta ON t.id = ta.team_id
WHERE lt.week_end = ''
GROUP BY
t.id, t.name, t.machine_name, lt.games_played, lt.games_won, lt.games_lost, lt.games_drawn, lt.legs_for, lt.legs_against
ORDER BY LegsFor DESC, NumGamesWon DESC, LegsAve DESC
No results available for the selected week.
I haven’t tested this much, but it might work!