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
how to dump all databases for backup. Backup file is sql commands to recreate all db's.
What is the usage of regular expressions in mysql?
can you tell the order of sql select statement? : Mysql dba
Is there a free version of mysql?
How to delete a column and add a new column to database
What is the password of mysql?
How do I download mysql on my laptop?
Where is mysql password stored?
Write a query to fetch duplicate records from a table using mysql?
How to display nth highest salary from a table in a mysql query?
Where is mysql used?
What is username in mysql?
What is the latest version of php and mysql?
How do you rename a procedure in mysql?
What you can use regular expression for in mysql? Support your answer with an example?