mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
30 lines
638 B
XML
30 lines
638 B
XML
|
<test>
|
||
|
|
||
|
<preconditions>
|
||
|
<table_exists>test.hits</table_exists>
|
||
|
</preconditions>
|
||
|
|
||
|
<query>
|
||
|
SELECT *
|
||
|
FROM
|
||
|
(
|
||
|
SELECT
|
||
|
RegionID,
|
||
|
toDateTime(EventDate) AS date,
|
||
|
count() AS quantity
|
||
|
FROM test.hits
|
||
|
GROUP BY
|
||
|
RegionID,
|
||
|
date
|
||
|
) AS regions
|
||
|
ASOF LEFT JOIN
|
||
|
(
|
||
|
SELECT
|
||
|
RegionID,
|
||
|
EventTime
|
||
|
FROM test.hits
|
||
|
) AS ids ON (regions.RegionID = ids.RegionID) AND (regions.date < ids.EventTime)
|
||
|
</query>
|
||
|
|
||
|
</test>
|