select
Date, [Close],
avg([close]) over (order by date asc rows 4 preceding) as MA10
from
dbo.APPL
This query returns the rolling 4 day average of stock prices. However I want to show the values as NULL
if preceding days are fewer than 4.
How do I adjust that in SQL Server?