MySQL Error!
MySQL error in file: /engine/modules/zinter/matchcenter/functions/ttables_data.php at line 567
Error Number: 1064
The Error returned was:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '=@_last_,@curRank:=@curRank,@curRank:=@_sequence) AS rank, @_sequenc...' at line 38
SQL query:

select if ( (b.name_rus = "" or b.name_rus is null), b.name_eng, b.name_rus) as name, b.slug as team_slug, b.version as team_version, b.tag,b.code, b.id, c.slug as country_slug, c.name_rus as country_name, x.id, x.played, x.played_home, x.played_away, x.points, x.points_home, x.points_away, x.wins, x.wins_home, x.wins_away, x.lost, x.lost_home, x.lost_away, x.draws, x.draws_home, x.draws_away, x.goal_diff, x.goal_diff_home, x.goal_diff_away, x.goalsfor, x.goalsfor_home, x.goalsfor_away, x.goalsagainst, x.goalsagainst_home, x.goalsagainst_away, x.points_loose, x.points_loose_home, x.points_loose_away, x.streak, x.streak_home, x.streak_away, x.penalties, IF(x.=@_last_,@curRank:=@curRank,@curRank:=@_sequence) AS rank, @_sequence as rank_seq, @_sequence:=@_sequence+1,@_last_:=x. from (select team_id as id, count(*) played, count(CASE WHEN place = 'home' THEN 1 END) played_home, count(CASE WHEN place = 'away' THEN 1 END) played_away, sum( case when goalsfor > goalsagainst then 3 else 0 end + case when goalsfor = goalsagainst then 1 else 0 end ) - if((select count(*) from zinter_season_penalties as sp where sp.team_id = a.team_id and season_id = 212 and sp.date <= max(a.date)) > 0,(select sum(sp.penalty) FROM `zinter_season_penalties` as sp WHERE sp.team_id = a.team_id and season_id = 212),0) points, sum( case when place = 'home' and goalsfor > goalsagainst then 3 else 0 end + case when place = 'home' and goalsfor = goalsagainst then 1 else 0 end ) points_home, sum(case when place = 'away' and goalsfor > goalsagainst then 3 else 0 end + case when place = 'away' and goalsfor = goalsagainst then 1 else 0 end) points_away, count(CASE WHEN goalsfor > goalsagainst THEN 1 END) wins, count(CASE WHEN place = 'home' AND goalsfor > goalsagainst THEN 1 END) wins_home, count(CASE WHEN place = 'away' AND goalsfor > goalsagainst THEN 1 END) wins_away, count(case when goalsfor < goalsagainst then 1 end) lost, count(CASE WHEN place = 'home' AND goalsfor < goalsagainst THEN 1 END) lost_home, count(CASE WHEN place = 'away' AND goalsfor < goalsagainst THEN 1 END) lost_away, count(case when goalsfor = goalsagainst then 1 end) draws, count(CASE WHEN place = 'home' AND goalsfor = goalsagainst THEN 1 END) draws_home, count(CASE WHEN place = 'away' AND goalsfor = goalsagainst THEN 1 END) draws_away, sum(goalsfor) - sum(goalsagainst) goal_diff, sum(case when place = 'home' then goalsfor else 0 end) - sum(case when place = 'home' then goalsagainst else 0 end) goal_diff_home, sum(case when place = 'away' then goalsfor else 0 end) - sum(case when place = 'away' then goalsagainst else 0 end) goal_diff_away, sum(goalsfor) goalsfor, sum(case when place = 'home' then goalsfor else 0 end) goalsfor_home, sum(case when place = 'away' then goalsfor else 0 end) goalsfor_away, sum(goalsagainst) goalsagainst, sum(case when place = 'home' then goalsagainst else 0 end) goalsagainst_home, sum(case when place = 'away' then goalsagainst else 0 end) goalsagainst_away, (count(*)*3) - sum(case when goalsfor > goalsagainst then 3 else 0 end + case when goalsfor = goalsagainst then 1 else 0 end ) + if((select count(*) from zinter_season_penalties as sp where sp.team_id = a.team_id and season_id = 212) > 0,(select sum(sp.penalty) FROM `zinter_season_penalties` as sp WHERE sp.team_id = a.team_id and season_id = 212 and sp.date <= max(a.date)),0) points_loose, (count(CASE WHEN place = 'home' THEN 1 END)*3) - sum(case when place = 'home' and goalsfor > goalsagainst then 3 else 0 end + case when place = 'home' and goalsfor = goalsagainst then 1 else 0 end ) points_loose_home, (count(CASE WHEN place = 'away' THEN 1 END)*3) - sum(case when place = 'away' and goalsfor > goalsagainst then 3 else 0 end + case when place = 'away' and goalsfor = goalsagainst then 1 else 0 end ) points_loose_away, GROUP_CONCAT((CASE WHEN goalsfor > goalsagainst THEN 'W' WHEN goalsfor = goalsagainst THEN 'D' WHEN goalsfor < goalsagainst THEN 'L' END) ORDER BY date ASC separator '') streak, GROUP_CONCAT((CASE WHEN place = 'home' and goalsfor > goalsagainst THEN 'W' WHEN place = 'home' and goalsfor = goalsagainst THEN 'D' WHEN place = 'home' and goalsfor < goalsagainst THEN 'L' END) ORDER BY date ASC separator '') streak_home, GROUP_CONCAT((CASE WHEN place = 'away' and goalsfor > goalsagainst THEN 'W' WHEN place = 'away' and goalsfor = goalsagainst THEN 'D' WHEN place = 'away' and goalsfor < goalsagainst THEN 'L' END) ORDER BY date ASC separator '') streak_away, if((select count(*) from zinter_season_penalties as sp where sp.team_id = a.team_id and season_id = 212) > 0,(select sum(sp.penalty) FROM `zinter_season_penalties` as sp WHERE sp.team_id = a.team_id and season_id = 212 and sp.date <= max(a.date)),0) penalties from (select date, away_id as team_id, ag as goalsfor, hg as goalsagainst,'away' as place from zinter_matches where status = 50 and season_id = 212 and stage = "regular" ) a group by team_id order by ) as x left join `zinter_teams` as b on x.id = b.id left join `zinter_countries` as c on b.country_id = c.id ,(SELECT @curRank := 0, @_sequence:=1, @_last_:=-9999) r