Unknown column ‘id‘ in ‘field list‘ / 字段列表中的未知列“id” / 字段列表中的未知列“xxx” / 字段命名时前不小心加了空格导致的报错

报错描述:

Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:
**Error querying database. **
Cause: java.sql.SQLSyntaxErrorException: Unknown column ‘id’ in ‘field list’
The error may exist in com/oa/mapper/JobMapper.java (best guess)
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: SELECT id,name,remark,del FROM tb_job WHERE (del = ?) LIMIT ?,?
Cause: java.sql.SQLSyntaxErrorException: Unknown column ‘id’ in ‘field list’

跳转请求时报错了:
Unknown column ‘id’ in ‘field list’ (字段列表中的未知列“id”),但你对比数据库表中的id字段感觉也没错啊….

报错原因/解决方法:
id前多了一个空格。(命名时先按了“空格”+id导致的错误),去掉空格,即可正常运行

Unknown column ‘id‘ in ‘field list‘ / 字段列表中的未知列“id” / 字段列表中的未知列“xxx” / 字段命名时前不小心加了空格导致的报错_第1张图片
Unknown column ‘id‘ in ‘field list‘ / 字段列表中的未知列“id” / 字段列表中的未知列“xxx” / 字段命名时前不小心加了空格导致的报错_第2张图片

你可能感兴趣的:(java,mysql,sql)