Any advice on count  when sum 0

Hi there
We would like to have 1 sql such that
count when sum of value in column > 0 . Problem is sum an aggregate function and also count.
As example imagine 2 customer records, one has a -ve value e.g -4 and 1 a positive value of +5 so sum of these values = +1. Such a customer we would like to include in the count and can't simply use having clause as we wish to include in report all sales reagrdless of whether > 0 but a separate count field to highlight the ones which are greater than 0
Current sql
select sum(value), cola..
from table
group by col1..
can't say
select count(case when sum(value) > 0 then distinct cust_id end)
as get ora-message about nested group by functions..
Anybody done such a thing before - would analytical functions work in this situation.
Many Thanks

Hi there,
Thanks very much for the replies.
One problem though, unfortunately the reporting tool we use is quite constrained and we can't implement the solutions proposed in it - they would have been preferable.
Example of data
table called transaction with all different types of transactions
Main fields, trans-code, cust_id, product_id, trans_qty, trans_date
Each row has a different trans code, e.g supply code, return code.
We wish to identify no of custs sold out. A customer could have several supply transaction records for the same product and potentially several different return transactions.
If the sum of all the supply transactions for a customer/product > 0 and the sum of all the credit transactions for a customer/product = 0 then we count this as a sell-out.
Is it possible to code this as an analytical function - if so how?
Many Thanks

Similar Messages

Maybe you are looking for

  • Custom Search Portlet : Find all item created in a such year

    Hi, I'd like to find the way to search for items created in a such year. I have added the 'created on' attribute in the form, but the operator is equal lower of higher. What I need is to find the item created from 1st January to 31 December. Does any

  • What are the defaul username and password for SQL Plus ?

    hello, what are the defaul username and password for SQL Plus ? i'm using the client 11.2.0.1

  • Can't remove CS2

    I get an error message when I try to remove it. It says something about Windows XP Service Pack 3 Help! I need to get my photoshop back!

  • How to test RAM and HDD (Hard Drive).

    Introduction HP machines have built-in Bios testers for RAM and HDD's. To use them you need to enter Bios by pressing F10 on startup. They are placed under ' Diagnostics menu '. Why I wrote this guide and complicate whole situation? There are three

  • Unable to download apps without app world

    I have problems downloading apps without my app world as it doesn't want to download. But it is possible to download without app world. When I get to the page where I have to sign in my BB I.D it links me to another page that says my cookies are turn