Database query failed: Unknown column 'g.comp_id' in 'on clause'

Last SQL query: SELECT DATE_FORMAT( time, '%Y-%m-%d' ) FROM games AS g INNER JOIN competitions as cmp on cmp.id=g.comp_id INNER JOIN events as e on e.id=cmp.event_id WHERE DATE_FORMAT(time, '%Y-%m-%d') = CURDATE() AND e.season_id = 5 LIMIT 0,1