Unknown column ‘张三‘ in ‘where clause‘

简介: Unknown column ‘张三‘ in ‘where clause‘

报错信息:Unknown column '张三' in 'where clause'

报错原因:通常这个报错是因为数据库表中不存在这个字段,但是我这里不是这个问题,我这里是因为我的sql语句有点问题


原来的sql语句:String sql = "select * from returns where name="+name;


修改后的sql语句:String sql = "select * from returns where name="+" ' "+name+" ' ";


这里报错是因为sql语句中的name是中文,所以需要加上单引号,不然会报错


目录
相关文章
|
2月前
|
SQL 关系型数据库 MySQL
Unknown column ‘xx’ in ‘on clause’
Unknown column ‘xx’ in ‘on clause’
9 0
|
6月前
|
数据库
解决which is not functionally dependent on columns in GROUP BY clause;...sql_mode=only_full_group_by
解决which is not functionally dependent on columns in GROUP BY clause;...sql_mode=only_full_group_by
44 0
|
8月前
|
存储 SQL 关系型数据库
1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column的解决办法
1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column的解决办法
87 0
|
10月前
|
关系型数据库 MySQL 数据库
View ‘information_schema.SCHEMATA‘ references invalid table(s) or column(s) or function(s) or define
View ‘information_schema.SCHEMATA‘ references invalid table(s) or column(s) or function(s) or define
140 0
|
数据库
Incorrect table definition; there can be only one auto column and it must be defined as a key
Incorrect table definition; there can be only one auto column and it must be defined as a key
122 0
Incorrect table definition; there can be only one auto column and it must be defined as a key
1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause
1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause
172 0
1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause
|
SQL 关系型数据库 MySQL
【已解决】SELECT list is not in GROUP BY clause and contains nonaggregated column
MySQL5.7.5后only_full_group_by成为sql_mode的默认选项之一,这可能导致一些sql语句失效。
188 0
|
SQL 关系型数据库 MySQL
报错:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregat
报错:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregat
280 0
报错:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregat
|
关系型数据库 MySQL 数据库
MySQL - Column 'id' in where clause is ambiguous
MySQL - Column 'id' in where clause is ambiguous
588 0
|
SQL 关系型数据库 MySQL
MySQL - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column
MySQL - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column
161 0