SQL 查询优化:统计 iOS 和 Android 应用数量
SELECT SUM(cnt) AS total_count FROM ( select count(DISTINCT AppIdentifier) AS cnt from ( select AppIdentifier, min(Ds) as Ds from log_iMonkey_iOS_overview GROUP BY AppIdentifier ) t1 where toDate(Ds) >= subtractDays(toDate(now()), 1) union all select count(DISTINCT AppIdentifier) AS cnt from ( select AppIdentifier, min(Ds) as Ds from log_iMonkey_Android_overview where PlatformType != 0 GROUP BY AppIdentifier ) t2 where toDate(Ds) >= subtractDays(toDate(now()), 1) union all select count(DISTINCT PlatformType) AS cnt from ( select PlatformType, min(Ds) as Ds from log_iMonkey_Android_overview where PlatformType != 0 GROUP BY PlatformType ) t3 where toDate(Ds) >= subtractDays(toDate(now()), 1) ) AS subquery
原文地址: https://www.cveoy.top/t/topic/pQWq 著作权归作者所有。请勿转载和采集!