"select * from"
"(select toStartOfInterval(time_local, interval 3600 second) as interval, remote_addr, "
"count(distinct http_user_agent), count(http_user_agent) "
"from accesslog.default where time_local > (now() - toIntervalMinute(240)) "
"group by interval, remote_addr order by interval, remote_addr) as t1"
"inner join"
"(select * from accesslog.default where time_local > (now() - toIntervalMinute(240))) as t2 "
"on t1.remote_addr=t2.remote_addr"
DB::Exception: Missing columns: 't1.remote_addr' while processing query
time_local remote_addr
datetime.datetime(2022, 10, 21, 11, 0), IPv4Address('1.1.1.1'), 1, 2)
bytes remote_addr http_user_agent
62, IPv4Address('1.1.1.1'), 'Ubrd/13337 CFNetwork/1335.0.3 Darwin/21.6.0',
SELECT *
FROM (
SELECT toStartOfInterval(time_local, interval 3600 SECOND) AS interval,
remote_addr,
count(DISTINCT http_user_agent),
count(http_user_agent)
FROM accesslog.default
WHERE time_local > (now() - toIntervalMinute(240))
GROUP BY interval, remote_addr
ORDER BY interval, remote_addr
) AS t1
INNER JOIN (
SELECT *
FROM accesslog.default
WHERE time_local > (now() - toIntervalMinute(240))
) AS t2 ON t1.remote_addr=t2.remote_addr
select * from
(select toStartOfInterval(time_local, interval 3600 second) as interval, remote_addr,
count(distinct http_user_agent), count(http_user_agent)
from accesslog.default where time_local > (now() - toIntervalMinute(240))
group by interval, remote_addr order by interval, remote_addr) as t1
inner join
(select * from accesslog.default where time_local > (now() - toIntervalMinute(240))) as t2
on t1.remote_addr=t2.remote_addr
Taking all the columns via * is available only if tables are joined, not subqueries.