T-SQL calculate moving average
The window functions in SQL 2008 are rather limited compared to later versions and if I remember correct you can only partition and you can’t use any rows/range frame limit but I think this might be what you want: ;WITH cte (rn, transactionid, value) AS ( SELECT rn = ROW_NUMBER() OVER (ORDER BY transactionid), transactionid, … Read more