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

Viknesh Janakiraman 1 Reputation point
2022-06-19T06:00:28.22+00:00

Hi,
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...
Thanks

212717-doubt-1.png

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,372 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,682 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Viknesh Janakiraman 1 Reputation point
    2022-06-19T08:44:40.77+00:00

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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.