Oracle数据库如何实现左外联和右外联

WBOY
풀어 주다: 2016-06-07 17:45:42
원래의
1584명이 탐색했습니다.

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_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) 

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!