I have a table like this tblData (month int,Qty int)

and i am inserting three rows in this table
1.tblData Values (1,100)
2.tblData Values (2,200)
3.tblData Values (3,300)

The Result I want is the Running total of the field Qty

that is 1 100 100
2 200 300
3 300 600

What is the Query for that ?

Answer Posted / shaik

select a.month,a.quantity,sum(b.quantity) as total from qunt
a cross join qunt b
where b.month<=a.month
group by a.month,a.quantity
order by month

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I uninstall mysql connector?

466


What is ntext?

602


How do I stop a mysql command?

473


What is the difference between char and varchar?

534


How to Change a users password from MySQL prompt. Login as root. Set the password. Update privs.

565






Does mysql case matter?

479


What is memory table?

486


How to display top 10 rows in mysql?

572


How do I restore a database in mysql workbench?

483


What is the difference between procedure and function in mysql?

497


How to convert character strings to dates?

521


What is procedure in mysql?

469


Can a table have multiple primary keys?

475


What is the maximum size of table in mysql?

550


How to copy data from one server to another using php?

519