Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Question on Query
Hello,
I have the following query:
SELECT p.product_id "PRODUCT ID", p.name "PRODUCT NAME", count(*)
"ACTIVE"
FROM customer.subscriptions s, customer.product p
WHERE p.product_id = s.product_id AND exp_date > SYSDATE
GROUP BY p.product_id, p.name
ORDER BY p.product_id;
This works fine. However, what I need to do is SUM certain product numbers together and not others. So, if I have the following data:
PRODUCT ID
1
2
3
4
5
I want to sum product ID's 1 + 3, and the others will not be summed. Can this be done in a query? Maybe with DECODE?
Thanks everyone! Received on Mon Nov 26 2007 - 08:55:47 CST
![]() |
![]() |