ClickHouse/tests/queries/1_stateful/00038_uniq_state_merge2.sql
2024-02-15 04:56:14 +01:00

3 lines
281 B
SQL

SET max_bytes_before_external_group_by = '1G';
SELECT topLevelDomain(concat('http://', k)) AS tld, sum(u) AS u, uniqMerge(us) AS us FROM (SELECT domain(URL) AS k, uniq(UserID) AS u, uniqState(UserID) AS us FROM test.hits GROUP BY k) GROUP BY tld ORDER BY u DESC, tld ASC LIMIT 100