I need help writing select statement that will do an average of the most recent 52 rows of data.
If there is less then 52 rows it will only do the avg of how many rows there are.
I know the avg function in SQL will skip the null...but i got this far.
SELECT AVG(E.Interest)
from InterestRates E
Where Interest in (select COUNT(Interest) <=52 from InterestRates)
i wanted for each row of data to go back and calculate the avg 52 rows thanks