https://questdb.io logo
Title
s

Super Richman

05/22/2023, 4:16 PM
When using AVG on implicit join tables, where the first table have will the AVG function take into account the entire period of the right table? such as
SELECT g.timestamp,g.galon_price,avg(t.price) from gas_prices g, trades t where g.timestamp=t.timestamp
will
avg(t.price)
be the avg of each date but also the avg of all dates? from my check the answer is no, I tried
SAMPLE BY
but that doesn't work
b

Bolek Ziobrowski

05/22/2023, 8:33 PM
I'm not sure I get the question . Keyed aggregate is computed on the result of hash join between the two tables . If you require aggregate to work on one table only then do it in a subquery before the join .