|Subject:||Question on Query|
|Date:||Mon, 26 Nov 2007|
I have the following query:
SELECT p.product_id "PRODUCT ID", p.name "PRODUCT NAME", count(*)
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:
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?