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 / sandhirasegaran

SELECT tbl1.month,tbl1.Qty,( SELECT SUM(tbl2.Qty) FROM
tblData AS tbl2 WHERE tbl1.month >= tbl2.month ) FROM
tblData AS tbl1

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do we delete a row in a table?

525


What is clob datatype?

474


Explain about reporting services of MYSQL?

604


How to show all tables with 'mysql'?

516


What is save point in mysql?

508






Explain the difference between primary key and candidate key in mysql?

504


What is table level locking in mysql?

471


Is pdo faster than mysqli?

462


1)for snapshot replication which agents used? 2)for Transcation replication which agents used? 3)for merge replciation which agents used?

1543


How to show all records starting with the letters 'sonia' and the phone number '9876543210'

509


How does select query work?

483


What are the purposes of using enum and set data types?

502


How do I backup mysql database on linux?

476


What is 1nf 2nf 3nf?

493


What is pragma serially_reusable and why is it used?

467