Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ANSI Standard decode to CASE

521609Feb 7 2008 — edited Feb 10 2008
Hi all,

select
id
,one
,two
From
(select id
, one
, two
, Max(decode(TYPE, "ER", 3*4, 4*7)
from
(select id
, sum(one) as one
, sum(two) as two
from t1
group by id)
group by id, one, two
) temp inner join t2....

The above query is just a sample structure to tell the problem that i am facing. It works fine, but i need to convert it to ANSI Standard.

Hence I need to convert the DECODE to CASE statement. but if i convert to CASE, i need to use any of the GROUP BY FUNCTIONS, but if i use the MAX of any group by functions, the result would be wrong...how to overcome it

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 9 2008
Added on Feb 7 2008
5 comments
1,059 views