AH. AH. - 1 year ago 94
MySQL Question

Unknown column in JOIN ON statement MySQL

SELECT * FROM `a` LEFT JOIN `dates` ON `a.date_id`=`dates.id` AND `dates.date`>'19-09-2013'

The above query gets
#1054 - Unknown column 'a.date_id' in 'on clause'

Answer Source

If you escape a table or column name you have to do it seperatly

LEFT JOIN  `dates` ON a.date_id = `dates`.`id` AND `dates`.`date` > '19-09-2013'



instead of


But you actually only have to escape reserved words in MySQL.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download