在ClickHouse中,如果使用HAVING子句,必须在SELECT语句中包含聚合函数。根据你提供的查询语句,在GROUP BY子句之后没有聚合函数,因此导致语法错误。

要修复这个问题,你可以考虑在SELECT子句中添加适当的聚合函数。例如,你可以使用COUNT函数来计算每个组的记录数。下面是修改后的查询语句:

SELECT PlatformType AS PlatformType, CrashIdentifier, CrashContent2 AS stack, COUNT(*) AS count FROM log_iMonkey_Wechat_overview WHERE Debug = 1 AND PlatformType != 0 AND CrashIdentifier != '' AND toDate(Ds) >= subtractDays(toDate(now()), 1) GROUP BY PlatformType, CrashIdentifier, CrashContent2 ORDER BY PlatformType DESC;

这样修改后的查询将返回每个PlatformType、CrashIdentifier和CrashContent2组合的记录数。你也可以根据需要调整SELECT子句中的聚合函数。

SELECT PlatformType AS PlatformType CrashIdentifier CrashContent2 AS stackFROM log_iMonkey_Wechat_overviewWHERE Debug = 1 AND PlatformType != 0 AND CrashIdentifier != HAVING toDateminDs = s

原文地址: https://www.cveoy.top/t/topic/i5Ug 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录