Oracle資料庫如何?左外聯和右外聯

來源:互聯網
上載者:User

create or replace view V_WTK_ALL as

  select a.id, o.short as FindDeptName, u.realname as FindUserName, f.name as FindWay, o1.short as ProblemAtDeptName,

  z.name as szzz, a.yhnr, s.name as SSZY, k.name as kind, w.name as whhg, a.zgcs, a.zgfzr, a.plandate, a.finishdate,

  u1.realname as jdr, u2.realname as fxr, a.yqzt, a.yqdate, a.wtkzt

  from WTK a, ORGANIZATION o, ORGANIZATION o1, OPERATORS u,OPERATORS u1,OPERATORS u2, Kind k, Findway f, SPfield s, SZZZ z, WHHG w

  where a.finddeptid =o.id(+) and a.problematdeptid=o1.id(+) and a.finduserid=u.id(+) and a.jdr=u1.id(+) and a.fxr=u2.id(+)

  and a.kindid=k.id(+) and a.findwayid=f.id(+) and a.spfieldid=s.id(+) and a.szzid =z.id(+) and a.whhgid=w.id(+)

  有兩個表

  table1

  user_id     user_name     user_ps教程s

   1             aaa            a

   2             bbb            b

   3          ccc            c

  table2

  user_id     user_power

   1            111000

   2            000111

  使用sql語句查詢

  正常狀態:

  select table1.user_id,

  table1.user_name,

  table2.user_power

  from table1,table2

  where table1.user_id = table2.user_id

  但是這樣檢索到的資料只有兩條:

  user_id     user_name      user_power

  1           aaa            000111

  2           bbb            111000

  輸入你想轉換的文字內容,

  點擊下面按鈕進行線上轉換。

  select table1.user_id,table1.user_name,table2.user_power

  from table1,table2

  where table1.user_id (+)= table2.user_id

  就可以得到如下的結果

  user_id     user_name      user_power

  1             aaa             000111

  2             bbb             111000

  3             ccc             (null) 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.