最后一句是AND C.C_ID = 2
解决方案 »
- 请教个分区表问题
- oracle forms开发中的LOV和LIST有哪些区别
- 请教:怎样把oracle8库中的一个用户的表的约束导出?
- unix下Oracle10g怎么连接sql server
- 高分求教!有关导出导入的问题!
- 怎样插入大于4000的字符串?第---4-----次发----这么多分都没人会?
- 求一SQL,高手请进!
- ***怎么实现这样的查询?先查出所有的信息,最后进行统计。详情请进!***
- 如何删除dbms_job运行的一个计划任务???
- 查看过程的问题,急
- IMP-00016: 不支持要求的字符集转换(从类型850到852)?
- 在oracle中建立有多个数据库,怎样知道共有哪些库?怎样改变数据库的连接?
----------
101
102
103
104
105SQL> select * from a2;BBB CCC
---------- --------------------
101
102
105SQL> select * from a1,a2 where a1.bbb(+)=a2.bbb;BBB BBB CCC
---------- ---------- --------------------
101 101
102 102
105 105SQL> select * from a1,a2 where a1.bbb=a2.bbb(+);BBB BBB CCC
---------- ---------- --------------------
101 101
102 102
103
104
105 105SQL>
你好:你能用我提供的数据来测试一下吗,因为还有条件限制。我是这样写的
SELECT A.A_ID1,A.A_ID2,A.A_NAME,B.B_NAME,C.C_NAME
FROM A,B,C
WHERE A.A_ID1 = B.A_ID1
AND A.A_ID2 = B.A_ID2
AND B.B_ID = 1
A.A_ID1 = C.A_ID1
AND A.A_ID2 = C.A_ID2
AND C.B_ID = 2
bzszp(SongZip):
你好:你能用我提供的数据来测试一下吗,因为还有条件限制。我是这样写的
SELECT A.A_ID1,A.A_ID2,A.A_NAME,B.B_NAME,C.C_NAME
FROM A,B,C
WHERE A.A_ID1 = B.A_ID1(+)
AND A.A_ID2 = B.A_ID2(+)
AND B.B_ID = 1
AND A.A_ID1 = C.A_ID1(+)
AND A.A_ID2 = C.A_ID2(+)
AND C.C_ID = 2
以下面我用的实际sql来说明。
select a.order_num in_num,
'北京仓库' as whs_name,
a.source,
b.wm_date as in_date,
a.mat_num,
c.wm_date as out_date,
d.order_num out_num,
b.sap_mnt
from T_ORDER a,T_EXEC_SUMMARY b,T_EXEC_SUMMARY c,T_REVERSE_RECORD d
where a.biz_code = b.biz_code(+)
and a.order_num = b.order_num(+)
and a.order_pos = b.order_pos(+)
and b.order_num = c.order_num(+)
and b.order_pos = c.order_pos(+)
and a.rev_num = d.rev_num(+)
and a.biz_code = 'CI'
and c.biz_code = 'CO'
and b.rank_id = '5'
and c.rank_id = '1'
and d.biz_code = 'RE'
其中表T_REVERSE_RECORD中没有数据。查询结果为空。
但是只要我把and d.biz_code = 'RE'去掉,就能够查询出数据。
请问如何解决这个问题
'北京仓库' as whs_name,
a.source,
b.wm_date as in_date,
a.mat_num,
c.wm_date as out_date,
d.order_num out_num,
b.sap_mnt
from T_ORDER a,T_EXEC_SUMMARY b,T_EXEC_SUMMARY c,(select * from T_REVERSE_RECORD where biz_code = 'RE') d
where a.biz_code = b.biz_code(+)
and a.order_num = b.order_num(+)
and a.order_pos = b.order_pos(+)
and b.order_num = c.order_num(+)
and b.order_pos = c.order_pos(+)
and a.rev_num = d.rev_num(+)
and a.biz_code = 'CI'
and c.biz_code = 'CO'
and b.rank_id = '5'
and c.rank_id = '1'
--------- --------- ----------
1 1 A_11
2 1 A_21
3 1 A_31实际:60
08:33:28 SQL> select * from b; A_ID1 A_ID2 B_ID B_NAME
--------- --------- --------- ----------
1 1 1 B_111
1 1 2 B_112实际:50
08:33:32 SQL> select * from c; A_ID1 A_ID2 C_ID C_NAME
--------- --------- --------- ----------
2 1 1 C_211
2 1 2 C_212实际:40
08:33:36 SQL> select a.*,b.b_name,c.c_name from a,
08:33:42 2 (select * from b where b_id=1) b,//如果要加条件加在此处
08:33:42 3 (select * from c where c_id=2) c
08:33:43 4 where a.a_id1=b.a_id1(+) and a.a_id2=b.a_id2(+)
08:33:43 5 and a.a_id1=c.a_id1(+) and a.a_id2=b.a_id2(+); A_ID1 A_ID2 A_NAME B_NAME C_NAME
--------- --------- ---------- ---------- ----------
1 1 A_11 B_111
2 1 A_21 C_212
3 1 A_31实际:70
08:33:43 SQL>