mardi 5 mai 2015

Sum of Distinct count in Oracle

I have the following table:

CUST_PRODUCT_DTL

Cust_ID  Product_ID  QTY
1          10        5
2          10        2
3          10        5
1          11        5
2          12        1

How can I get Total Distinct CUST_ID, TOTAL DISTINCT PRODUCT_ID from the above table in Oracle 11 G

The below one doesn't work

SELECT SUM(COUNT(DISTINCT cust_id)), product_id 
FROM  CUST_PRODUCT_DTL 
WHERE  
GROUP BY product_id , cust_id

Aucun commentaire:

Enregistrer un commentaire