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

What is longblob?

545


How do you login to MySql using Unix shell?

620


Why do we use mysql?

489


What is the use of mysqli_connect in php?

477


How do I update a variable in mysql?

499






Write command to import an mysql file?

515


What is a simple query?

472


How can we find out which auto increment was assigned on Last insert?

630


What are programming functions?

492


What is mysql architecture?

509


How do I setup mysql?

498


How do you say mysql?

490


How do I install mysql workbench?

483


What is the hostname for mysql database?

475


Why we use mysql database?

489