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 ') AND t.as_game_id = g.as_game_id AND g.as_game_type_id =gt.as_game_type_i...' at line 24