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 happens when the column is set to AUTO INCREMENT and if you reach maximum value in the table?
What is row?
Why does mysql have so many connections?
How do I start and stop mysql server?
In how many ways we can retrieve data in the result set of mysql using php?
How do I install and use mysql?
write a command to view the content of the table
How to insert html code into mysql database using php?
How to print message in mysql trigger?
What are mysql data types?
What are the purposes of using enum and set data types?
Can you tell how to find the number of rows in a resultset using php?
Is blocked because of many connection errors unblock with mysqladmin flush hosts?
List some comparisons operators used in mysql?
How do I run mysql on a mac?