帮我修复一下这个bugJDBC 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 21:16:21 浏览: 137
com.springsource.org.postgresql.jdbc3-8.3.603.jar
这个错误是因为 SQL 查询语句中的某些字段没有在 GROUP BY 子句中出现,也没有使用聚合函数进行处理。你需要根据错误提示中提到的字段名,检查查询语句中是否缺少了 GROUP BY 或聚合函数的处理。如果你不确定如何修改查询语句,可以将完整的查询语句以及查询的数据表结构提供给有经验的 DBA 或开发人员进行修复。
阅读全文