Can I get mean of all numbers returned in a subquery? For example, I need to attach mean of all ‘y’ from another table which has ‘x’ less than the current row’s ‘x’.
Something like –
select a.x,
mean(b.y where b.x<a.x from data2 b) as m_y
from data1 a
It’s not working. What is the right syntax (or trick) for getting the result?
Never mind, I got it.
My sql rusted with nonuse.