Need help with query on summation of every rows with its next 3 rows

Viknesh Janakiraman 1 Reputation point

Pls help me with this by sending a working query.
Please take a look in the attached image.
I need to get the third column as output where, it is the sum of 4 rows i.e., (sum of every row + its next 3 rows = output in 4th row)
(eg. 10 + 20 +30 + 40 = 100 in 4th row)
(eg. 20 +30 + 40 + 50 = 140 in 5th row)... and so on...


SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
8,490 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Viknesh Janakiraman 1 Reputation point

    I have just started learning SQL. Thank you. It works

    No comments