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
I've looked but can't find a MySQL equivalent for MS SQL's xp_cmdshell. I have 7z files that I want to unzip and load into MySQL. I'm trying to write a sp to do the unzip, but I can't find a way to do that. Can anyone provide an example of a similar process in Windows? TIA.
What is sql vs mysql?
How do I flush privileges in mysql?
Is mysqli faster than mysql?
What is mysqli procedural?
What command is used to delete the data from the table without deleting the table structure?
How to create a test table in your mysql server?
What is a join? Explain the different types of mysql joins.
How to update a root password.
Is mysql connect deprecated?
What is the maximum number of columns per table?
What is mysql and why it is used?
How do I assign a variable in mysql?
what is the default port for mysql server? : Mysql dba
What is delimiter $$?