`
weibaojun
  • 浏览: 97943 次
  • 性别: Icon_minigender_1
  • 来自: 火星
社区版块
存档分类
最新评论

关于oracle外连接的问题

阅读更多

我写了一个sql如下:

select *
  from storage_market_fetch          f,
       storage_market_fetch_mat      m,
       storage_mar_fetch_collect_mat fm
 where f.fetch_bill_id = m.fetch_bill_id
   and m.mat_info_id = fm.mat_info_id(+)
   and f.is_deleted = 0
   and f.is_returned = 0
   and f.step = 9
   and fm.mat_info_id is null
   and m.pay_price is not null

我现在需要在fm表中加一个条件,就是加fm.is_disabled = 0这样一个条件,如果直接加在where条件的后面,是不行的,那么除了先查询记录再外连接的这种方法外,还有没有其他的方法,我这样写对不对,请高手指点一下。

select *
  from storage_market_fetch          f,
       storage_market_fetch_mat      m,
       storage_mar_fetch_collect_mat fm
 where f.fetch_bill_id = m.fetch_bill_id
   and m.mat_info_id = fm.mat_info_id(+)
   and f.is_deleted = 0
   and f.is_returned = 0
   and f.step = 9
   and fm.is_disabled(+) = 0
   and fm.mat_info_id is null
   and m.pay_price is not null

  就是在连接条件中加了and fm.is_disabled(+) = 0的条件,不知道对不对。 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics