JDBC Connection [org.postgresql.jdbc.PgConnection@49f1bf43] will not be managed by Spring ==> Preparing: select z.*,y.PDTCLASS_CLASS FROM ( SELECT * FROM (SELECT r.PDT_PLANEX_PDTID,r.PDT_PLANEX_TYPE ,r.SUM_NUM,e.SUM_NUM2,e.COUNT_NUM FROM (SELECT SUM(t.PDT_PLANEX_NUM) as SUM_NUM,t.PDT_PLANEX_PDTID,t.PDT_PLANEX_TYPE FROM c_pdt_plan_ex t WHERE t.PDT_PLANEX_DELETED = 0 and t.DATA_FROM = ? and to_timestamp(?, 'yyyy-MM-dd HH:mm:ss.SSS') >= t.PDT_PLANEX_BEGIN and t.PDT_PLANEX_END >= to_timestamp(?, 'yyyy-MM-dd HH:mm:ss.SSS') GROUP BY t.PDT_PLANEX_PDTID,t.PDT_PLANEX_TYPE )r LEFT JOIN (SELECT SUM(o.WEISHT_NET_WGHT) SUM_NUM2,COUNT(1) COUNT_NUM,o.PDTINF_PDT,o.PDTINF_CLASS,o.PDT_PLANEX_PDTID,o.PDT_PLANEX_TYPE FROM(SELECT * FROM(SELECT * FROM (SELECT q.*, p.* FROM ( SELECT t.PDT_PLANEX_ID, t.PDT_PLANEX_NUM, t.PDT_PLANEX_PDTID, t.PDT_PLANEX_TYPE, t.PDT_PLANEX_BEGIN, t.PDT_PLANEX_END, t.PDT_PLANEX_COID FROM c_pdt_plan_ex t WHERE t.PDT_PLANEX_DELETED = 0 and t.DATA_FROM = ? and to_timestamp(?, 'yyyy-MM-dd HH:mm:ss.SSS') >= t.PDT_PLANEX_BEGIN and t.PDT_PLANEX_END >= to_timestamp(?, 'yyyy-MM-dd HH:mm:ss.SSS') GROUP BY t.PDT_PLANEX_PDTID, t.PDT_PLANEX_COID, t.PDT_PLANEX_TYPE, t.PDT_PLANEX_BEGIN, t.PDT_PLANEX_END, t.PDT_PLANEX_COID ) q LEFT JOIN (SELECT PDTINF_PDT, PDTINF_ID , PDTINF_CLASS FROM c_products_info WHERE PDTINF_DELETED=0 and DATA_FROM = ? )p on q.PDT_PLANEX_PDTID=p.PDTINF_ID)k LEFT JOIN (select g.CPY_CO,g.CPY_ID from c_companys g where CPY_DELETED=0 and DATA_FROM = ? ) c ON k.PDT_PLANEX_COID=c.CPY_ID)k inner JOIN (select j.WEISHT_NET_WGHT,j.WEISHT_PRODUCT,j.WEISHT_CO,j.WEISHT_EMPTY_TM,j.WEISHT_FULL_TM from c_weight_sheets j where WEISHT_DELETED = 0 and DATA_FROM = ? )r ON k.PDTINF_PDT=r.WEISHT_PRODUCT and k.CPY_CO=r.WEISHT_CO AND k.PDT_PLANEX_BEGIN <= r.WEISHT_FULL_TM AND k.PDT_PLANEX_END >= r.WEISHT_FULL_TM ORDER BY k.PDTINF_PDT )o GROUP BY o.PDT_PLANEX_PDTID)e ON e.PDT_PLANEX_PDTID=r.PDT_PLANEX_PDTID AND e.PDT_PLANEX_TYPE=r.PDT_PLANEX_TYPE)w left join (SELECT PDTINF_PDT, PDTINF_ID , PDTINF_CLASS FROM c_products_info WHERE PDTINF_DELETED=0 and DATA_FROM = ? )p on w.PDT_PLANEX_PDTID=p.PDTINF_ID) z left join (select PDTCLASS_CLASS,PDTCLASS_ID from c_pdt_class where PDTCLASS_DELETED=0) y on z.PDTINF_CLASS=y.PDTCLASS_ID ==> Parameters: e9f6ed8e091611ec842700163e092c06(String), 2023-10-08 23:59:59(String), 2020-10-08 23:59:59(String), e9f6ed8e091611ec842700163e092c06(String), 2023-10-08 23:59:59(String), 2020-10-08 23:59:59(String), e9f6ed8e091611ec842700163e092c06(String), e9f6ed8e091611ec842700163e092c06(String), e9f6ed8e091611ec842700163e092c06(String), e9f6ed8e091611ec842700163e092c06(String) Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@57f98196] [2023-06-01 21:16:02] [ERROR] -- Servlet.service() for servlet [dispatcherServlet] in context with path [/szIntranetweb] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: org.postgresql.util.PSQLException: 错误: 字段 "t.pdt_planex_id" 必须出现在 GROUP BY 子句中或者在聚合函数中使用
时间: 2023-10-09 08:16:21 浏览: 148
这段代码看起来像是在执行一个 SQL 查询语句,但是出现了一个错误:字段 "t.pdt_planex_id" 必须出现在 GROUP BY 子句中或者在聚合函数中使用。这个错误通常是由于 SQL 查询语句中的 GROUP BY 子句不完整导致的。可能需要检查一下查询语句中的 GROUP BY 子句是否正确,并且检查一下对应的数据库表结构是否符合要求。
阅读全文