你好,我正在使用 JDBC 查询,但我遇到了这个错误,但我不明白为什么,或者这个错误的确切含义是什么以及查询有什么问题。查询如下private List<StatisticsLog> runStatistics(Integer partnerId, LocalDate ldStart, LocalDateTime ldtEnd, String statType) { return jdbcTemplate.query("SELECT S.APP_ID, S.LOG_TYPE, ACC.CONTACT_PERSON_FIRST_NAME, ACC.CONTACT_PERSON_LAST_NAME, ACV.VERSION_APP_NAME, " + "'" + statType.trim() + "' STATTYPE, " + "ACV.APP_CATALOG_ID, ACV.APP_CATALOG_VERSION_ID, ACV.VERSION, ACV.UPDATED_AT, ACV.VERSION_LOGO_EXT, ACV.HAS_LOGO, " + "LANG.LANGUAGE_NAME_SHORT, LANG.LANGUAGE_ID , S.count, S.PARTNER_ID, APP.CREATED_AT " + "FROM (SELECT partner_id, log_type, app_id, language_id, count(*) as count FROM public.statistics_log " + " WHERE partner_id = ? " + " and logged_at between ? and ? " + "group by 1, log_type, app_id, language_id) as S " + "INNER JOIN APP_CATALOG_ACCOUNT ACP ON ACP.APP_CATALOG_SERIAL_ID = S.APP_ID " + "INNER JOIN APP_CATALOG APP ON APP.APP_CATALOG_SERIAL_ID = S.APP_ID " + "INNER JOIN ACCOUNT ACC ON ACC.ACCOUNT_ID = S.PARTNER_ID " + "INNER JOIN APP_CATALOG_VERSION ACV on ACV.APP_CATALOG_SERIAL_ID = APP.APP_CATALOG_SERIAL_ID AND ACV.STATUS = 3 " + "INNER JOIN LANGUAGE LANG ON LANG.LANGUAGE_ID = ACV.LANGUAGE_ID " + "ORDER BY S.count desc ", new Object[] { partnerId, ldStart, ldtEnd }, new StatisticsLogRowMapper()); }STATUS = 3 INNER JOIN LANGUAGE LANG ON LANGUAGE_ID = ACV.LANGUAGE_ID ORDER BY S.count desc]; 嵌套异常是 org.postgresql.util.PSQLException:在此结果集中找不到列名 CREATED_AT。”在错误中似乎这个字段不存在如果您有任何想法可能出了什么问题或我可以尝试的事情,请不要犹豫发表评论,我将不胜感激,即使是最小的帮助谢谢。
1 回答
狐的传说
TA贡献1804条经验 获得超3个赞
我可以看到查询的第 2 行有一个错误 - + "'" + statType.trim() + "' STATTYPE, ",就在引号之后。STATTYPE 没有表引用,并附加了一个字符串。
添加回答
举报
0/150
提交
取消