ClickHouse max 函数报错: Aggregate function max requires single argument. (NUMBER_OF_ARGUMENTS_DOESNT_MATCH) 修复方法
SELECT toStartOfDay(toDateTime(Ds)) AS datetime_day_Ds, PlatformType AS PlatformType, max(MergedUrlCount) AS index_avgdevicetime_0 FROM log_iMonkey_Wechat_overview WHERE Debug = 0 AND PlatformType != 0 AND Ds >= toDateTime(#day_wechat_views_time.start#) AND Ds <= toDateTime(#day_wechat_views_time.end#) GROUP BY datetime_day_Ds, PlatformType ORDER BY datetime_day_Ds DESC, PlatformType DESC LIMIT 5000; 报错 errormessage: 运行SQL失败:[500]运行异常: Code: 42. DB::Exception: Aggregate function max requires single argument. (NUMBER_OF_ARGUMENTS_DOESNT_MATCH) (version 52.3.10.8) 代码怎么改内容:要修复这个错误,您需要将max函数的参数更改为单个参数。在这种情况下,将MergedUrlCount和MergedViewCount合并为单个列,并在max函数中使用该列。 修复后的代码如下: SELECT toStartOfDay(toDateTime(Ds)) AS datetime_day_Ds, PlatformType AS PlatformType, max(MergedUrlCount) AS index_avgdevicetime_0 FROM log_iMonkey_Wechat_overview WHERE Debug = 0 AND PlatformType != 0 AND Ds >= toDateTime(#day_wechat_views_time.start#) AND Ds <= toDateTime(#day_wechat_views_time.end#) GROUP BY datetime_day_Ds, PlatformType ORDER BY datetime_day_Ds DESC, PlatformType DESC LIMIT 5000;
原文地址: https://www.cveoy.top/t/topic/pxw3 著作权归作者所有。请勿转载和采集!