Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Question on Query

Question on Query

From: <mtek_at_mtekusa.com>
Date: Mon, 26 Nov 2007 06:55:47 -0800 (PST)
Message-ID: <ee29fb97-0c7f-49ef-ba88-95fdd5c19b47@e1g2000hsh.googlegroups.com>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US