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 the difference between mysql_connect and mysqli_connect?
How to include numeric values in sql statements?
How can you retrieve a particular number of records from a table?
What is blob and clob?
Can python connect to mysql?
What is 'mysqlshow'?
What is the use of count function in mysql?
Define REGEXP?
Where the database is stored in mysql?
How to use in conditions?
What is mysql uuid?
How to use 'mysql' to run sql statements?
What is slow query log in mysql?
What is dirty read and phantom read?
How to drop an existing index in mysql?