Using IF ELSE in Oracle

前端 未结 2 1249
一个人的身影
一个人的身影 2020-12-10 05:10

As a web developer, I know how to use the IF ELSE in multiple languages. However, I am learning how to write reports using TOAD for Oracle.

My question is, how do I

2条回答
  •  有刺的猬
    2020-12-10 05:55

    You can use Decode as well:

    SELECT DISTINCT a.item, decode(b.salesman,'VIKKIE','ICKY',Else),NVL(a.manufacturer,'Not Set')Manufacturer
    FROM inv_items a, arv_sales b
    WHERE a.co = b.co
          AND A.ITEM_KEY = b.item_key
          AND a.co = '100'
    AND a.item LIKE 'BX%'
    AND b.salesman in ('01','15')
    AND trans_date BETWEEN to_date('010113','mmddrr')
                             and to_date('011713','mmddrr')
    GROUP BY a.item, b.salesman, a.manufacturer
    ORDER BY a.item
    

提交回复
热议问题