Query: SELECT sm.id_member, sm.first_name, sm.last_name, IFNULL(SUM(IF(gg.outcome LIKE w%, 1, 0)), 0) as num, t.team_id, t.short_name, mt.jersey_id FROM smf_osm_goalie_games as gg LEFT JOIN smf_osm_teams as t USING(team_id) LEFT JOIN smf_osm_divisions as d ON(t.division = d.division_id) LEFT JOIN smf_osm_schedule as sch ON(gg.game_id = sch.game_id) LEFT JOIN smf_members as sm ON(gg.id_member = sm.id_member) LEFT JOIN smf_osm_member_teams as mt ON(gg.team_id = mt.team_id AND gg.id_member = mt.id_member) WHERE d.division_id = 173 AND sch.reg_play = 'r' AND mt.rostered = 1 GROUP BY gg.id_member, gg.team_id
Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%, 1, 0)), 0) as num, t.team_id, t.short_name, mt.jersey_id FROM ' at line 1