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
 SQL Server Development (2000)
 help needed on query

Author  Topic 

anruagsingh02
Starting Member

3 Posts

Posted - 2006-10-18 : 08:27:19
i have to find a row where the sum of one col exceeds a specified quantity... say there is one table classoom where there is weight col..now i want to find a row where the sum of the weight col exceeds 1000 kgs

-anurag

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-10-18 : 08:29:23
Somthing like this

Select * from tablename where weight > 1000

Chirag

http://chirikworld.blogspot.com/
Go to Top of Page

anruagsingh02
Starting Member

3 Posts

Posted - 2006-10-18 : 08:32:10
no dude that will give me rows where the weight is greater then 1000 but my question is that i want that row where the cumulative weight of all the rows above that row exceeds 1000

-anurag
Go to Top of Page

anruagsingh02
Starting Member

3 Posts

Posted - 2006-10-18 : 08:39:02
one solution is using a while loop but i need a more refined way .. possibly in one shot

-anurag
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-10-18 : 08:54:29
oks, you mean to say running totals..
just have a look at this links

http://blogs.conchango.com/jamiethomson/archive/2006/02/28/3001.aspx
http://www.sqlteam.com/item.asp?ItemID=3856

Chirag

http://chirikworld.blogspot.com/
Go to Top of Page
   

- Advertisement -