5 Replies Latest reply: Sep 11, 2013 9:23 AM by Johnbr (Oracle10G) RSS

    decode possible with conditional?

    Johnbr (Oracle10G)

      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