0

Can somebody point out why the following query fails?

SELECT 
references_translations.language_id, 
references_translations.active, 
references_translations.title, 
references_translations.slug, 
references_translations.body, 
references_translations.seo_title, 
references_translations.seo_description, 
references.* 

FROM (references) 

INNER JOIN references_translations ON references_translations.reference_id = references.id AND references_translations.language_id = 'nl' 

WHERE `references_translations`.`active` = 1;

I cant see why this query keeps failing. Couldn't find if any of my table or column names are reserved by MySQL.

Any pointers in the right direction would be greatly appreciated. Thanks in advance.

SolidSmile
  • 3,206
  • 4
  • 21
  • 24

2 Answers2

2

references is a reserved keyword, try to enclose it in backticks `.

Shef
  • 44,808
  • 15
  • 79
  • 90
  • 1
    *forehead slap* I knew it! Thanks – SolidSmile Jul 11 '11 at 14:13
  • @SolidSmile: We all have done it! I have learned a lesson to use backticks no matter if there is a reserved word in the table or column name. As a matter of fact, I am always harshly blamed for doing it, but I have never given up. – Shef Jul 11 '11 at 14:15
1

References is a Reserve word.

Checked from link below:

MySQL 5.5 Reserved-words

Nitin Midha
  • 2,258
  • 20
  • 22