mysql - 列名为 'from' 的 SQL 异常

标签 mysql sql

我有一个表,其中有一列名为“来自”。我想从中检索数据,所以我尝试了以下查询。

select title,from,grade from localcourses where title='new';

但是由于列名“来自”,我得到以下异常。

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from,grade from localcourses where title='new'

如何在不重命名列名的情况下避免这种情况?谢谢。

最佳答案

尝试——

select `title`,`from`,`grade` from localcourses where `title`='new';

关于mysql - 列名为 'from' 的 SQL 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7311990/

相关文章:

mysql - 存储排序顺序/优先级的最佳方式?

Mysql:在Mysql View 中添加主键?

sql - 在事务中使用@@IDENTITY 是否安全?

sql - 附加两个 SQLite-DB 文件以在 Swift 中查询这两个文件

mysql - 在 phpMyAdmin 中存储数组( double )

php - 将数据从Web表单输入到mysql中

mysql - Facebook 唯一标识符

sql - 将数据合并在一列中是错误的吗?

sql - SQL-获取平均年龄在范围内的用户数

sql - 关于如何读取SQL执行计划的问题