ClickHouse/dbms/tests/queries/1_stateful/00043_any_left_join.sql
2018-08-07 20:08:51 +03:00

16 lines
258 B
SQL

SELECT
CounterID,
count() AS hits,
any(visits)
FROM test.hits ANY LEFT JOIN
(
SELECT
CounterID,
sum(Sign) AS visits
FROM test.visits
GROUP BY CounterID
) USING CounterID
GROUP BY CounterID
ORDER BY hits DESC
LIMIT 10;