oracle 输出空值不显示出来,oracle左外连接不显示正确的空值

我在oracle中创建一个查询似乎不想加入缺少值的问题

我有这个表:

table myTable(refnum,contid,type)

values are:

1,10,90000

2,20,90000

3,30,90000

4,10000

5,10000

6,20000

7,20000

8,20000

这是我以后的领域的分解:

select a.refnum from myTable a where type = 90000

select b.refnum from myTable b where type = 10000 and contid in (select contid from myTable where type = 90000)

select c.refnum from myTable c where type = 20000 and contid in (select contid from myTable where type = 90000)

我以后查询的结果是:

a.refnum,b.refnum,c.refnum

我以为这会工作:

select a.refnum,c.refnum

from myTable a

left outer join myTable b on (a.contid = b.contid)

left outer join myTable c on (a.contid = c.contid)

where a.id_tp_cd = 90000

and b.id_tp_cd = 10000

and c.id_tp_cd = 20000

所以值应该是:

1,null,6

2,4,7

3,5,8

但它唯一的回报:

2,8

我以为左连接会显示左边的所有值,并为右边创建一个空值.

帮帮我 :(

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值