select countDISTINCT AppIdentifier from log_iMonkey_iOS_overviewWHERE TimeStamp = subtractDaystoDatenow 30union allselect countDISTINCT PlatformType from log_iMonkey_Android_overviewWHERE TimeStamp =
你可以使用子查询和UNION ALL操作符来实现这个目标。以下是一个可能的解决方案:
SELECT SUM(cnt) AS total_count FROM ( SELECT COUNT(DISTINCT AppIdentifier) AS cnt FROM log_iMonkey_iOS_overview WHERE TimeStamp >= subtractDays(toDate(now()), 30) UNION ALL SELECT COUNT(DISTINCT PlatformType) AS cnt FROM log_iMonkey_Android_overview WHERE TimeStamp >= subtractDays(toDate(now()), 30) AND PlatformType != 0 ) AS subquery
原文地址: http://www.cveoy.top/t/topic/h7LU 著作权归作者所有。请勿转载和采集!