Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Calculating unique sums
That's it - simple enough. For some reason it wasn't working before when I tried this. I suspect some subtle typo or ordering problem. The actual statement is far more complex so I probably just over thought the problem.
Thanks!
steveee_ca_at_my-deja.com wrote:
> Hi,
> I hope I have your question right..you show a 'count' field in your
> example, so I'm thinking you want to count the number of different
> customers that had a transaction involving a product?
>
> Try this..
>
> SELECT PRODUCTID,COUNT(DISTINCT CUSTOMER_ID)
> FROM TRANSACTIONS
> GROUP BY PRODUCTID;
>
> I hope this does it for you.
>
> Steve
>
> In article <3A2415EC.4B55861A_at_weinerfamily.org>,
> sw_at_weinerfamily.org wrote:
> > I have a transaction table: transaction_id,product_id,customer_id.
> > I want to get list of UNIQUE customers (not # of transactions) that
> > purchased each product.
> > The result may look something like this:
> > Product Customer Count
> > A 500
> > B 23
> > C 175
> >
> > Does anyone have advice on the most efficient way to do this? I am
> > dealing with hundreds of millions of transactions.
> >
> > Thanks
> >
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Wed Nov 29 2000 - 09:19:41 CST
![]() |
![]() |