Invalid query: ("SELECT j.name AS Team, j.abbreviation AS ShortName, club.name AS Club, c.name AS Country, ser.name AS Division, ps.name AS Pool, COALESCE(k.games,0) + COALESCE(v.games,0) AS Games, COALESCE(k.wins,0) + COALESCE(v.wins,0) AS Wins, COALESCE(k.scores,0) + COALESCE(v.scores,0) AS GoalsFor, COALESCE(k.against,0) + COALESCE(v.against,0) AS GoalsAgainst, COALESCE(k.spirit,0) + COALESCE(v.spirit,0) AS SpiritPoints FROM uo_team AS j LEFT JOIN (SELECT COUNT(*) AS games, COUNT(homescore>visitorscore OR NULL) as wins, COUNT(homescore=visitorscore OR NULL) as draws, COUNT(homescorevisitorscore OR NULL) as losses, visitorteam, FORMAT(SUM(visitorscore),0) AS scores, FORMAT(SUM(visitorsotg),0) AS spirit, FORMAT(SUM(homescore),0) AS against FROM uo_game LEFT JOIN uo_game_pool gp2 ON(game_id=gp2.game) WHERE isongoing=0 AND gp2.timetable=1 GROUP BY visitorteam) AS v ON (j.team_id=v.visitorteam) LEFT JOIN uo_series ser ON(ser.series_id=j.series) LEFT JOIN uo_pool ps ON (j.pool=ps.pool_id) LEFT JOIN uo_club club ON (j.club=club.club_id) LEFT JOIN uo_country c ON (j.country=c.country_id) WHERE ser.season='SFLSL2022' GROUP BY j.team_id ORDER BY ser.ordering, j.name")
Unknown column 'homesotg' in 'SELECT'