error getting fixtures SELECT f.id, f.squadid, s.squadname, f.date, f.opponentname, f.leagueid, leaguename, date_format(f.date,'%a %D %b %Y') as nicedate, f.location, f.opponentid, f.fix_opp_id, f.teamvis, f.id as fixtureid, f.writeup, year(f.date) as year, gamepointsforwin, gamepointsfordraw,gamepointsforlose, gamescoring, f.adjustment, fopp.adjustment as opponent_adjustment FROM fixtures f INNER JOIN leagues l ON l.id=f.leagueid INNER JOIN squads s ON s.id=f.squadid LEFT JOIN fixtures fopp ON fopp.id = f.fix_opp_id LEFT JOIN squads opponentsquad ON opponentsquad.id = f.opponentid WHERE 1=1 AND f.date <= CURDATE() AND (s.squadname = 4 OR opponentsquad.squadname = 4) ORDER BY date desc, f.time desc, GREATEST(f.fix_opp_id, f.id), location LIMIT 600