java - Hibernate 和 MYSQL:您的 SQL 语法有错误?
问题描述
我的 java 代码中有以下查询:
String queryString = "select \r\n" +
"cms.status_id as 'statusId',\r\n" +
"cms.status_label as 'statusLabel',\r\n" +
"csl.status as 'status',\r\n" +
"from "+client+".my_status cms \r\n" +
"join "+client+".status_list csl on csl.status = cms.status_id\r\n";
当我运行代码时,出现以下错误:
SQL Error: 1064, SQLState: 42000
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax
这可能是什么原因造成的?我看不到我的查询有问题,我可以手动让它工作。
解决方案
您在此行中有一个额外的逗号:
"csl.status as 'status',\r\n" +
推荐阅读
- git - 克隆新的 git 存储库,获取和推送旧存储库的 url
- java - Apache FOP 设置动态 DPI
- c# - 在 MVC 视图中更改 DropDownListFor 中 SelectList 的输出值
- php - 为什么 PHP 路由器给我错误 301 永久移动?
- python-3.x - 如何不等待功能完成?
- python - 如何在 Dockerfile 中的 CMD 之后运行 python 脚本?
- google-workspace-add-ons - 无法从工作区插件中检索电子表格 ID
- tensorflow - TypeError: __init__() 得到了一个意外的关键字参数“logdir”
- android - 改变材料滑块的高度
- node.js - cloudWatch 中缺少 nodejs 日志