SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 query question
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

cronid
Starting Member

26 Posts

Posted - 10/03/2006 :  11:15:39  Show Profile  Reply with Quote
I’ve got a table of cusips and account holdings where I only want to display the cusips whose holdings’ sum does not equal 0. It’s the fourth cusip in the example below. Do you have an idea about how to code the sql?

Cusip holding

00080S101000 -71
00080S101000 200
00080S101000 -100
00080S101000 -29
00104Q107000 9605
00104Q107000 -9605
001204106000 100
001204106000 131
001204106000 -231
00163T109000 -214
00163T109000 114

madhivanan
Premature Yak Congratulator

India
22754 Posts

Posted - 10/03/2006 :  11:21:44  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Can you some sample data?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

harsh_athalye
Flowing Fount of Yak Knowledge

India
5509 Posts

Posted - 10/03/2006 :  11:22:11  Show Profile  Visit harsh_athalye's Homepage  Click to see harsh_athalye's MSN Messenger address  Send harsh_athalye a Yahoo! Message  Reply with Quote
Like this??

Select CUSIP
From Tbl
Group by CUSIP
having sum(holding) <> 0


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17595 Posts

Posted - 10/03/2006 :  11:22:21  Show Profile  Reply with Quote

select	Cusip
from	table
group by Cusip
having sum(holding) <> 0



KH

Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17595 Posts

Posted - 10/03/2006 :  11:22:52  Show Profile  Reply with Quote
x 2


KH

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000