You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
来源:互联网 发布:优化探究答案 编辑:程序博客网 时间:2024/04/19 11:02
我在MySql数据库中建了一个行政区域表obj_District,表中包含如下字段:
当我执行如下查询"select Distinct from obj_district",数据库报出如下错误提示:
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 obj_district' at line 1
后来经查证,原来是因为表中的“District”字段与MySql数据库的关键字重名了。
至于mysql有哪些关键字,大家可以很容易从网上查到,我就不多说了。
这时,我们有两个解决办法:
方法一:
将冲突字段重命名
方法二:
在写查询时,将冲突字段加上反单引号,例如:
select `Distinct` from obj_district
注意加的是反单引号,不是单引号。
反单引号在键盘上数字“1”左边那个键,直接按下就能打出反单引号。
0 0
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
- ntohs, ntohl, htons,htonl的比较和详解
- 以超级管理员身份运行bat
- java 访问部署在hdfs上hbase数据库
- golang连接mongodb
- UVA 1009 Balloons in a Box 枚举
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
- PrimeFaces 4.0 使用 <p:fileDownload> 标签实现文件下载
- gridview中嵌套button控件获取值
- typedef usage
- ios中对事件动作的三种处理方式
- 研究生应该知道的东西!
- GroupBox控件
- MVC保证线程内实例唯一(5)
- Google Test-Primer