错的
select gl.* from G_LINE GL, O_ORG OO where gl.org_no=oo.org_no(+) and oo.org_no like '43401%' order by line_id
我以左表位基础,查询数据,而我有一个条件却是 右表的 gl.org_no like '43401%'
如果有这样一条数据 org_no = 434010406 ,虽然 o_org表中没有这个org_no,
因为我是以左表为基础,查询 org_no 可以为空的 就是说 左表没有对应的org_no,也会查询出来一条数据来,
但是,因为我又加了一个条件 oo.org_no like '43401%' ,org_no = 434010406 不满足这条记录,所以
这条记录就被过滤掉了,而我不想让这条数据被过滤掉 虽然这条数据 的org_no 在 在O_org表中没有对应的值
修改方法
select gl.* from G_LINE GL, O_ORG OO where gl.org_no=oo.org_no(+) and oo.org_no like '43401%' order by line_id
做比较的 select gl.* from G_LINE GL where gl.org_no like '43401%' order by line_id 216行