【问题标题】:Hibernate and MYSQL: You have an error in your SQL syntax?Hibernate 和 MYSQL:您的 SQL 语法有错误?
【发布时间】:2020-08-17 14:46:44
【问题描述】:

我的 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

这可能是什么原因造成的?我看不到我的查询有问题,我可以手动让它工作。

【问题讨论】:

    标签: java mysql sql hibernate mysql-error-1064


    【解决方案1】:

    你在这一行多了一个逗号:

     "csl.status as 'status',\r\n" +
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-19
      • 2013-02-01
      • 2015-07-02
      • 1970-01-01
      • 2012-10-10
      • 1970-01-01
      • 2014-10-25
      • 2019-12-03
      相关资源
      最近更新 更多