报错信息:Cause: org.postgresql.util.PSQLException: 错误: 字段 "s.re_scan_dt" 必须出现在 GROUP BY 子句中或者在聚合函数中使用
以下是报错sql:
select count(1)
from t_task_his t left join t_scan_record_his s
on t.ts_id = s.ts_id and t.ts_item_code = s.ts_item_code
and date(s.re_scan_dt) between to_date(${scanDateTimeStart},'YYYY-MM-DD')
and to_date(${scanDateTimeEnd},'YYYY-MM-DD')
order by re_scan_dt
把 order by re_scan_dt 去掉就行了,因为count(1) / sum(xx) 这种类型的方法的sql 尾部不能 + 排序方法