Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Running Total help - newbie

Author  Topic 

eewald
Starting Member

2 Posts

Posted - 2005-02-16 : 14:49:02
I'm pretty new to SQL and I'm trying to calculate cumulative amounts from a table.

The issue is that I need to group these amounts based on other fields.

For instance. I have Fields (Name,Category,subcategory, Amount, Quarter, Year).

I am trying to calculate the cumulative amount (at the end of the quarter for all quarters before it) per any combination of Name,Category and subcategory. Each row has its own amount and falls within 1 of each of those other fields.

Is there any documentation for doing this anywhere that could get me started.

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2005-02-16 : 15:36:50
SQL doesn't inherently do running totals as a recordset does not have an order unless it is specified in the query.

If you show us a sample of what you want to do (DDL - would be create statements for the tables and DML would be adding sample data to those tables) and of course some info on what the result should be, we could provide much better direction

Corey

"If the only tool you have is a hammer, the whole world looks like a nail." - Mark Twain
Go to Top of Page
   

- Advertisement -