麦粉社区
>
帖子详情

参数定义 查询出错

电子表格软件 发表于 2023-5-19 10:32
发表于 2023-5-19 10:32:52

现在只要多选或者多加一个条件就报错,是哪里设置有问题吗?

点击显示栈信息,把栈信息发出来看看具体报什么错
以及截图看看当前sql怎么写的
  •   小古
        select
            T91.`PK_ID` as `F86`,
            T92.`EMP_NAME` as `F88`,
            T3.`DEPT_NAME` as `F1`,
            T192.`WORKINGREPORTDEVICE_NAME` as `F200`,
            T201.`SKILLCERTIFICATE_NAME` as `F199`,
            T91.`CREATED_TIME` as `F101`,
            T91.`START_TIME` as `F105`,
            T91.`END_TIME` as `F106`
        from
            `com_department` T3
        inner join
            `com_employee` T92
                on T92.`DEPARTMENT_PK_ID` = T3.`PK_ID`
        inner join
            `mes_start_work_logs` T91
                on T91.`EMPLOYEE_PK_ID` = T92.`PK_ID`
        inner join
            `mes_working_report_device` T192
                on T91.`REPORT_DEVICES_PK_ID` = T192.`PK_ID`
        inner join
            `com_employee_skill` T93
                on T92.`PK_ID` = T93.`EMPLOYEE_PK_ID`
        inner join
            `com_skillcertificate` T201
                on T93.`EMPLOYEE_SKILL_PK_ID` = T201.`PK_ID`
        where
            T192.`WORKINGREPORTDEVICE_NAME` = 'CS报工机'
            and T92.`EMP_NAME` =  'CS生产'
    
    2023-5-19 11:21| 回复
  •   小古
    version:	2020-10-29 17:41:47
    packageinfo:	Branch_SmartbiV85_6_20190221 
    
    
    获取数据SQL错误:select T132.`F86` as F133,T132.`F88` as F135,T132.`F1` as F136,T132.`F200` as F238,T132.`F199` as F239,T132.`F101` as F138,T132.`F105` as F139,T132.`F106` as F140  from (select  T91.`PK_ID` as `F86`,T92.`EMP_NAME` as `F88`,T3.`DEPT_NAME` as `F1`,T192.`WORKINGREPORTDEVICE_NAME` as `F200`,T201.`SKILLCERTIFICATE_NAME` as `F199`,T91.`CREATED_TIME` as `F101`,T91.`START_TIME` as `F105`,T91.`END_TIME` as `F106`  from `com_department` T3 inner join `com_employee` T92 on T92.`DEPARTMENT_PK_ID` = T3.`PK_ID` inner join `mes_start_work_logs` T91 on T91.`EMPLOYEE_PK_ID` = T92.`PK_ID` inner join `mes_working_report_device` T192 on T91.`REPORT_DEVICES_PK_ID` = T192.`PK_ID` inner join `com_employee_skill` T93 on T92.`PK_ID` = T93.`EMPLOYEE_PK_ID` inner join `com_skillcertificate` T201 on T93.`EMPLOYEE_SKILL_PK_ID` = T201.`PK_ID` where T192.`WORKINGREPORTDEVICE_NAME` = 'CS报工机' and T92.`EMP_NAME` =
     'CS生产','吴金喜') T132;You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''吴金喜') T132 limit 1000' at line 2
    	at smartbi.freequery.querydata.store.DBSQLResultStore.executeInDatabaseInner(DBSQLResultStore.java:1872)
    	at ...(...)
    	at smartbi.log.PreparedStatementWarp.executeQuery(PreparedStatementWarp.java:144)
    Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''吴金喜') T132 limit 1000' at line 2
    	at sun.reflect.GeneratedConstructorAccessor186.newInstance(Unknown Source)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    	at com.mysql.jdbc.Util.getInstance(Util.java:386)
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190)
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122)
    	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)
    	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)
    	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2818)
    	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2157)
    	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2324)
    	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
    	at smartbi.log.PreparedStatementWarp.executeQuery(PreparedStatementWarp.java:144)
    	at smartbi.freequery.querydata.store.DBSQLResultStore.runSQL(DBSQLResultStore.java:4440)
    	at smartbi.freequery.querydata.store.DBSQLResultStore.executeInDatabaseInner(DBSQLResultStore.java:1830)
    	at smartbi.freequery.querydata.store.DBSQLResultStore.executeInDatabase(DBSQLResultStore.java:1683)
    	at smartbi.freequery.querydata.store.DBSQLResultStore.ensureGridDataInMemDB(DBSQLResultStore.java:5957)
    	at smartbi.freequery.querydata.store.DBSQLResultStore.getGridDataInternal(DBSQLResultStore.java:5159)
    	at smartbi.freequery.querydata.store.SQLResultStore.getGridData(SQLResultStore.java:165)
    	at smartbi.freequery.report.SimpleReportBO.getGridDataInternal(SimpleReportBO.java:1444)
    	at smartbi.freequery.report.SimpleReportBO.getGridDataInternal(SimpleReportBO.java:1378)
    	at smartbi.freequery.report.SimpleReportBO.getGridData(SimpleReportBO.java:1233)
    	at smartbi.freequery.client.simplereport.ClientReportService.getReportDataInPage(ClientReportService.java:797)
    	at smartbi.freequery.client.simplereport.ClientReportService.getReportDataWithFutureInPage(ClientReportService.java:874)
    	at smartbi.freequery.client.simplereport.ClientReportService.getReportDataWithFuture(ClientReportService.java:846)
    	at sun.reflect.GeneratedMethodAccessor1150.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at smartbi.framework.rmi.ClientService.execute(Smartbi:118)
    	at smartbi.framework.rmi.RMIServlet.processExecute(RMIServlet.java:226)
    	at smartbi.framework.rmi.RMIServlet.doPost(RMIServlet.java:164)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at smartbi.extension.ExtensionFilter$2.doFilter(ExtensionFilter.java:167)
    	at smartbi.extension.ExtensionFilter$1.doFilter(ExtensionFilter.java:156)
    	at smartbi.extension.ExtensionFilter.doFilterInternal(ExtensionFilter.java:179)
    	at smartbi.extension.ExtensionFilter.doFilter(ExtensionFilter.java:64)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at smartbi.framework.rmi.TransactionFilter.doFilter(Smartbi:102)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at smartbi.freequery.filter.GZIPFilter.doFilter(GZIPFilter.java:177)
    	at smartbi.freequery.filter.Filter.doFilter(Filter.java:36)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at smartbi.freequery.filter.CheckIsLoggedFilter.doFilter(CheckIsLoggedFilter.java:161)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at smartbi.freequery.filter.TraceFilter.doFilter(TraceFilter.java:59)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:748)
    
    2023-5-19 11:22| 回复
  •   一周只洗一次澡的脏脏包
     回复 小古
    T92.`EMP_NAME` =( 'CS生产','吴金喜')
    多个值的时候不要要用in吗,不能用=
    后续如果出现类似报错,建议可以检查相关sql语法是否正确,以及可以把sql放到数据库管理工具中执行看看是否有报错,如果有的话,可尝试自行调整sql语法
    2023-5-19 14:31| 回复
  •   小古
     回复 一周只洗一次澡的脏脏包
    非常感谢,明白了,我是照着教程弄的,他那教程就是为了单选,不是为了多选设置的。
    2023-5-22 14:55| 回复

回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

5回帖数 0关注人数 446浏览人数
最后回复于:2023-5-19 11:11
快速回复 返回顶部 返回列表