在预期的位置找不到java关键字

mi7gmzs6  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(315)

我如何修复关键字未找到的地方预期的错误!请任何人帮忙谢谢
执行查询时“from关键字not found where expected”

String query = "select  bc.institution_code,bc.branch_code,tmp.order_channel,tmp.order_root_div,"
        + "count(ls.session_id) as tenlogincount from branch bc,login_session ls,(select    a.session_id,a.branch_id,"
        + "b.order_channel,c.order_root_div from(select session_id,property_value as branch_id"
        + "from login_session_property where property_name = 'branchID') a,(select session_id,"
        + "property_value as order_channel from login_session_property where property_name = 'orderChannel') b,"
        + "(select  session_id,property_value as order_root_div from login_session_property"
        + "where property_name = 'orderRootDiv') c where    a.session_id = b.session_id"
        + "and  b.session_id = c.session_id) tmp where  to_char(ls.creation_date, 'YYYY-MM-DD') = ?"
        + "and  ls.type_id in  (select type_id from login_type where type_name like '%customer_login_type%')"
        + "and  ls.session_id = tmp.session_id and  bc.branch_id = tmp.branch_id"
        + "and  ((to_char(ls.creation_date,'HH24MI') <= ? and to_char(ls.last_update,'HH24MI') >= ?"
        + "and  ls.validity <> 0) or    (to_char(ls.creation_date,'HH24MI') <= ?"
        + "and  to_char(ls.expiration_date,'HH24MI') >= ? and   ls.validity = 0)) group by bc.institution_code,"
        + "bc.branch_code,tmp.order_channel,tmp.order_root_div";
avwztpqn

avwztpqn1#

连接字符串时,需要用空格分隔单词。
例如在第3行的末尾之间 as branch_id 从第四行开始 from login_session_property . 这将成为 as branch_idfrom login_session_property . 看到错误了吗?这没有道理。
只要确保在每行末尾加一个空格,以确保在构建整个字符串时将单词分隔开。第3行的结尾应该是 as branch_id <--此处末尾有一个额外的空格。
你有好几行同样的错误。

相关问题