从列名为“name_en-GB”的数据库中检索数据

时间:2013-09-25 06:11:43

标签: mysql

我的数据库中有一个表我需要从中检索数据所有工作正常但我有一个列名为name_en-GB当我试图从中检索数据时,它给出了错误

select * from table where name_en-GB='Name';

错误是:

Unknown column 'name_en' in 'where clause'

我所知道的是在“ - ”之后数据正在逃逸。我已经搜索过这个但我无法得到它。如何从这个专栏中获取数据 提前致谢

3 个答案:

答案 0 :(得分:3)

尝试使用

select * from table where `name_en-GB`='Name'

答案 1 :(得分:0)

可怕的列名,但您需要做的就是引用它作为标识符,例如

select * from table where `name_en-GB` = 'Name';

有关详细信息,请参阅http://dev.mysql.com/doc/refman/5.0/en/identifiers.html

答案 2 :(得分:-1)

您可以将列名更改为name_en_GB

相关问题