Unknown column 'media.media_ritid' in 'on clause' SELECT media.media_id as id, media.media_content as content, media.media_filename as filename, media.media_titel as titel, media.media_datum as datum, media_type.media_type_code as type, rit.rit_afstand as dst FROM media INNER JOIN media_type ON (media_type.media_type_id = media.media_typeid) LEFT JOIN rit ON (rit.rit_id = media.media_ritid) WHERE media_tochtid = 775