Question on Query

Giganews Newsgroups
Subject: Question on Query
Posted by:  mt…@mtekusa.com
Date: Mon, 26 Nov 2007

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!

Replies