nag k

nag k

  • NA
  • 14
  • 2.1k

how to calculate sum for every 5 rows in sql

Nov 29 2014 4:29 AM
hi iam new to sql Database.i have a problem my table is like this




id |name| | amount
---------------------
1 | xyz | 15

2 | xyz | 54

3 | xyz | 787

2 | xyz | 455

3 | hhh | 58

3 | hhh | 789

3 | hhh | 478

3 | hhh | 7855

and i want result like this .


id |name| | amount
---------------------
1 | xyz | 15

2 | xyz | 54

3 | xyz | 787

4 | xyz | 455
              -----------
   toatal  1311
            -----------
5 | hhh | 58

6 | hhh | 789

7 | hhh | 478

8 | hhh | 7855
               -----------
     toatal 9180
                 -----------

Answers (1)