易截截图软件、单文件、免安装、纯绿色、仅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标准

谢谢各位啦!


相关问答:

oracle sql developer 查询显示中文乱码

环境:1.win2003server+oracle9i
2.oracle9i字符集为AMERICAN_AMERICA.WE8ISO8859P1
3.oracle sql developer版本 1.5.5
现象描述: 1.在sql developer 中查询oracle中的某个表,中文全部显示为乱码。 ......

PHP 连接Oracle 出错

<?php
  getenv("ORACLE_HOME");
  $conn=ocilogon("test","test","test_db");
  if($conn)  
  echo success;  
&nb ......

delphi 怎么将oracle的long raw 字段值 导入blob字段

delphi 怎么将oracle的long raw 字段值 导入blob字段

http://blog.csdn.net/zxf_feng/archive/2008/12/21/3571961.aspx
看看这个

引用
            vStream := TMemorySt ......

求助ORACLE批量清除表数据的问题 - Oracle / 开发

比如我有testA、testB、testC三个表
我现在需要写一个批处理或者脚本给别人 作用就是执行这段语句可以清除这三个表里面的数据 就是一个初始化的意思
哪位高人帮助下啊 一个数据库小白在此求救啦
SQL code:
......

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号