Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Whats wrong with this decode sql query.
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