易截截图软件、单文件、免安装、纯绿色、仅160KB

oracle 左连接问题

select a.id, b.id
  from a, b
where a.cn = b.cn(+)
  and b.type(+) = '1'


select a.id, b.id
  from a, b
where a.cn = b.cn(+)
  and b.type = '1'

这2段sql文执行结果有什么不一样?
with a as(select 1 id,'a' str from dual
  union all select 2,'a' from dual
  union all select 3,'a' from dual),
b as(select 1 id,'b' str from dual
  union all select 2,null from dual)
select * from a,b
where a.id=b.id(+)
  and b.str='b'

b.str后面添上和去掉(+)看看结果有什么不同



楼主的这种写法不熟悉. 建议用left join, 这种写法在可读性上要好点.  至于结果有什么不一样,楼主运行一下就知道了

SELECT A.id, A.name from A LEFT JOIN B ON A.id=B.id where A.id=2

引用
第一个相当于
select a.id, b.id
  from a left join b
on a.cn = b.cn
  and b.type = '1'

第二个相当于
select a.id, b.id
  from a left join b
on a.cn = b.cn
where b.type = '1'


对,可以按照狂狼这样的方式改成left join

我和Dave一样,更喜欢用left join,熟悉而且是SQL标准

谢谢各位啦!


相关问答:

linux + oracle用XP访问不了

我安装一台redhat linux5+oracle 10g的服务器,笔记本(XP系统)安装了oracle 10g客户端,结果老是出12560的错误,请高手指点一二,

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dpor ......

急寻Oracle ERP实施顾问

3-5人,工作地点上海浦东软件园,2-3年经验,英文流利,有意者请联系38954510-1355,15821699737,y.ming@live.cn
自己顶。。。

没有ORACLE ERP的经验,有用友和TIPTOP经验,英语说不好,看还是可以!
不知道有没有 ......

借水源人气!oracle job问题!在线等

我写的一个Job
declare
  job1 integer;
begin
  dbms_job.submit(job1,
    'Sale_FinanceUseFee(4,null,null,null);',
    TRUNC(SYSDATE)+1.103, ......

imp 导入 oracle 问题

导出、导入都是 oracle 10g 。

在导入过程中出现如下情况:

IMP-00017: 由于 ORACLE 错误 6550, 以下语句失败:
"DECLARE  SREC DBMS_STATS.STATREC; BEGIN SREC.MINVAL := '4E014E50 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号