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 / anurag misra
select a.month,a.Qty,sum(b.Qty) as total
from tblData a cross join tblData b
where b.month<=a.month
group by a.month,a.Qty
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is blob datatype in mysql?
Explain the storage engines in mysql?
What are the 5 r's of managing behaviors?
How to install mysql?
How are mysql timestamps seen to a user?
Is there a free mysql?
If you wish to encrypt the username and password using php, how will you do that?
Will mysql remain free?
can you tell the order of sql select statement? : Mysql dba
How do I view mysql logs?
How do I restore a database in mysql workbench?
Can we store pdf files in mysql?
Which is faster innodb or myisam?
What is bigint in mysql?
how to display nth highest salary from a table in a mysql query? : Mysql dba