How to escape value keyword in mysql while using Select statement

后端 未结 1 1780
被撕碎了的回忆
被撕碎了的回忆 2021-01-24 17:02

I am facing a problem while using Select statement where I have a column name as \'Value\', and I want to retrieve the values based on the \'value\' column with SELECT

相关标签:
1条回答
  • 2021-01-24 17:12

    You escape literals in MySQL using backticks `

    SELECT compo.clecompo FROM compo compo ON (compo.clecompo = metadatas_compo.clecompo) AND ((metadatas_compo.`value` LIKE '%%NOM%%') OR (metadatas_values.metavalues_name LIKE '%%NOM%%'))
    

    However, it is advised to not use reserved literals in your table/column names. For a list of reserved words:

    http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html

    0 讨论(0)
提交回复
热议问题