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 / shaik
select a.month,a.quantity,sum(b.quantity) as total from qunt
a cross join qunt b
where b.month<=a.month
group by a.month,a.quantity
order by month
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is mysql57?
What is the use of mysql_fetch_array () function in php?
How to display top 50 rows?
How to create table with same structure of student table in mysql?
How do you use auto increment?
How many sql ddl commands are supported by 'mysql'?
What is difference between group by and order by clause?
What is relational database in mysql?
Can't connect mysql server on localhost?
Why use stored procedures in mysql?
What is pdo mysql?
Why is it called mysql?
What is different between sql and mysql?
how to get only updated, deleted , inserted records after certain interval time in mysql with out using triggers...
What is ibdata1?