SQL 错误 [1105] [HY000]: errCode = 2, detailMessage = select list expression not produced by aggregation output (missing from GROUP BY clause?): ......
SQL 错误 [1105] [HY000]: errCode = 2, detailMessage = select list expression not produced by aggregation output (missing from GROUP BY clause?): ......
今天查询doris数据库发现一直报错说group by少了字段,于是记录下
报错原因:select的字段重命名与表字段冲突,重新命名即可
例如:
假设actd表有字段id,如下会报错,修改第一行id 重命名为id1 和group by 后为id1修复
SELECT max(id) id,
trx_date,
SUM(trx_cnt) AS trx_cnt,
FROM
actd
GROUP BY
id,
acct_tp
修正:
SELECT max(id) id1,
trx_date,
SUM(trx_cnt) AS trx_cnt,
FROM
actd
GROUP BY
id1,
acct_tp
(记录一下我的sql问题)...