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
How do we delete a row in a table?
What is clob datatype?
Explain about reporting services of MYSQL?
How to show all tables with 'mysql'?
What is save point in mysql?
Explain the difference between primary key and candidate key in mysql?
What is table level locking in mysql?
Is pdo faster than mysqli?
1)for snapshot replication which agents used? 2)for Transcation replication which agents used? 3)for merge replciation which agents used?
How to show all records starting with the letters 'sonia' and the phone number '9876543210'
How does select query work?
What are the purposes of using enum and set data types?
How do I backup mysql database on linux?
What is 1nf 2nf 3nf?
What is pragma serially_reusable and why is it used?