This discussion is archived
5 Replies Latest reply: Sep 11, 2013 7:23 AM by Johnbr (Oracle10G) RSS

decode possible with conditional?

Johnbr (Oracle10G) Newbie
Currently Being Moderated

Hi All,

 

I'm using the decode function (thanks to admin1)... is there a way to use a conditional statement such as the following? Instead of only finding activity codes of 0 and 30, I want to find anything that is not 10 or 20

 

decode("Activity Code", ("Activity Code" !=10 or "Activity Code" !=20), "Activity Code") "Activity Code",

 

 

select

decode("Activity Code", 0, 30, "Activity Code") "Activity Code",
"Activity Code Desc",
SUM(Regular) as Regular,
SUM(OT) as OT,
SUM(NonProd) as NonProd,
Department

FROM
(...

) t

group by
decode("Activity Code", 0, 30, "Activity Code"),

"Activity Code Desc",
Department

ORDER BY
"Activity Code" ASC

 

thanks,

 

John

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points