Q&A about the site for administrators, end users, developers and designers for Craft CMS
DECLARE @ INT=10 CREATE table #t(a int,i int identity) INSERT #t values(3),(1),(4),(1),(5) SELECT sum(a*@-~-@*i*m)FROM(SELECT i/max(i)over()m,*FROM #t)x