使用(+)操作符指定外连接

使用(+)操作符指定外连接

如果使用(+)操作符指定外连接,必须使用where子句指定连接条件。
例如:表a,表b
a.i(+)=b.j 右连接

a.i=b.j(+)左连接

    select
        T1.ENTITY_ID as "entityId",
        T1.MERCHANT_CODE as "merchantCode",
        T1.MERCHANT_NAME as "merchantName",
        T1.MERCHANT_REALITY_NAME as "merchantRealityName",
        T1.MERCHANT_ENGLISH_NAME as "englishName",
        decode(T1.MERCHANT_STATE,'1','审核通过','0','无效','2','未审核','3','审核未通过') as "merchantState",
        T2.DICT_NAME as "merchantAttribute",
        decode(T1.E_PAY_IN ,'0','否','1','是') as "ePayIn",
        decode(T1.DATA_STATE,'0','已注销','1','未注销') as "dataState"
    from
        TB_MERCHANT T1 ,TB_DICT_INFO T2 
    		 
    where T1.MERCHANT_ATTRIBUTE(+)=T2.DICT_CODE
          and  T1.DATA_STATE = 1 



你可能感兴趣的:(sql)