mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
22 lines
313 B
MySQL
22 lines
313 B
MySQL
|
SELECT
|
||
|
CounterID,
|
||
|
hits,
|
||
|
visits
|
||
|
FROM
|
||
|
(
|
||
|
SELECT
|
||
|
CounterID,
|
||
|
count() AS hits
|
||
|
FROM test.hits
|
||
|
GROUP BY CounterID
|
||
|
) ANY LEFT JOIN
|
||
|
(
|
||
|
SELECT
|
||
|
CounterID,
|
||
|
sum(Sign) AS visits
|
||
|
FROM test.visits
|
||
|
GROUP BY CounterID
|
||
|
) USING CounterID
|
||
|
ORDER BY hits DESC
|
||
|
LIMIT 10;
|