June 12, 2009 at 6:06 am
Hi,
Name Marks
Ashok 20
Kamal 30
Thiru 40
This is my table. I need a output like this
Name Marks Total
Ashok 20 20
Kamal 30 50
Thiru 40 90
U see the output table. In column Marks i added one by one to Total.First row is default.
LIke 20,20+30,20+30+40 likewise i need to add in Total column
What is the sql query for this one?
June 12, 2009 at 7:04 am
this is known as a "running totals" problem. running totals require a defined ORDER BY...wkether it is a PK, or alphabetically, or whatever...your example so far does not meet the requirement.
take a look at this article about running totals[/url]. If you can post a true CREATE TABLE definition along with the INSERT INTO sample data, we could help a lot better.
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply