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

Home -> Community -> Usenet -> c.d.o.misc -> Whats wrong with this decode sql query.

Whats wrong with this decode sql query.

From: TR <tristan_robinson_at_cooltoad.com>
Date: 8 Mar 2006 11:28:39 -0800
Message-ID: <1141846119.536879.174290@u72g2000cwu.googlegroups.com>


Hi,

I want to use a nested sql using decode. I have given the following command:

SELECT A.TYPE,
(SELECT SUM(DECODE(TYPE,'HOT',1,0)) HOT_CAKE,
SUM(DECODE(TYPE,'SWEET',1,0)) SWEET_CAKE FROM PRODUCT_DETAIL
WHERE PRODUCT_CODE = 1
GROUP BY TYPE) A,
(SELECT SUM(DECODE(TYPE,'HOT',1,0)) HOT_BURGER,
SUM(DECODE(TYPE,'SWEET',1,0)) SWEET_BURGER FROM PRODUCT_DETAIL
WHERE PRODUCT_CODE = 2
GROUP BY TYPE) B
WHERE A.TYPE = B.TYPE; Can any one plz tell me what's wrong in the above command and show me the correct one.

Thank you.

TR. Received on Wed Mar 08 2006 - 13:28:39 CST

Original text of this message

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