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 ?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / bibinsami3
i Will give 3 pts to them who find the answer with out
reffering any Documets.. :)
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / 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 |
Where is mysql data stored?
how to search second maximum(second highest) salary value(integer)from table employee (field salary)in the manner so that mysql gets less load?
How to get nth highest salary from table in a mysql?
How can you change the password of a mysql user?
How To see all the tables from a database of mysql server.
Which statement is used to delete a table in MySQL.
What is unsigned in mysql?
What is the data type for file in mysql?
How do you know if your mysql server is alive?
How can I create a database in mysql?
What is mysql data directory?
What is the difference between the primary and unique key in mysql?