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
what is the difference between between and in operators in mysql?
What is mysql enterprise edition?
How do I run a query in mysql?
how to show all records starting with the letters 'sonia' and the phone number '9876543210' limit to records 1 through 5.
What is the maximum connection pool size?
Where’s database data actually stored?
Why we use mysql database?
How can you filter the duplicate data while retrieving records from the table?
What is the insert?
How to drop an existing view in mysql?
Consider you have the following three tables which have to be linked together.
How to give user privilages for a db. Login as root. Switch to the mysql db. Grant privs. Update privs.
Consider you have a composite index of three columns. Now, you have to provide the value of two columns in the where clause of a select query. Do you think index can be used for the operation?
How do I install mysql?
How do I connect to a database in mysql workbench?