Let's say I have a weather table:
MONTH, DAY, LOW
6, 1, 67.47084426063374
6, 2, 66.90195288599919
6, 3, 62.16084275276963
I want to select the avg low temperature for the month and am trying this:
SELECT t.* FROM (
select p.month, avg(p.low) over (partition by p.month) avg_low
from table p
) t;
The averaging is working but I'm getting 3 duplicate records back. How can I just return a single record?
(Also, when I try to round these round(avg(p.low),2)
, I'm told "FROM keyword not found where expected")