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



I have a table like this tblData (month int,Qty int) and i am inserting three rows in this table ..

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

I have a table like this tblData (month int,Qty int) and i am inserting three rows in this table ..

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

I have a table like this tblData (month int,Qty int) and i am inserting three rows in this table ..

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




I have a table like this tblData (month int,Qty int) and i am inserting three rows in this table ..

Answer / 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



More MySQL Interview Questions

Give the syntax of GRANT commands?

3 Answers  


what are the optimization techniques for Query optimization performance issues and faster execution of queries

2 Answers   Infosys, Sierra Atlantica,


How do you change a password for an existing user via mysqladmin?

2 Answers  


What are CSV tables?

1 Answers  


how we connect the data base in any programme

2 Answers  






what programming language which is used for testing and developement in sql?

3 Answers  


what is the main difference between myisam and innodb

2 Answers   Wipro,


how to display only 4 records from a table based on a condition for ex i have a table called products in that nid,prodname are fields i want to display only any 4 records of perticular product plz tell me

6 Answers  


What is Inner Joints and Outer Joints ? What is right outer joints,left outer joints,right inner joints , left inner joints ,

2 Answers   HP,


Hi! I’m doing one Project in vb.net 2008 using mysql .In that Project have the following Issues.. 1.if one Employee getting Salary 1.2 lacs / annum means .. After he getting 1st month Salary i want to show remaining 11 month salary.. How can i Create Trigger for this Problem & How can i use it..

1 Answers  


Give the syntax of Grant and Revoke commands?

1 Answers  


How do you convert to a different table type?

1 Answers  






Categories