mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
16 lines
258 B
MySQL
16 lines
258 B
MySQL
|
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;
|