有三张表分别如下:一: T_WORK_PLAN
字段:
tsk
二: VW_TSK
字段
tsk (PK )
pro_code,(唯一)
tsk_name,
三: T_PROCESS_RESULT
字段
pro_code 其中 T_PROCESS_RESULT 要和T_WORK_PLAN 进行全外连接
所以借助于 VW_TSK 表请问这句SQL应该怎么写啊
字段:
tsk
二: VW_TSK
字段
tsk (PK )
pro_code,(唯一)
tsk_name,
三: T_PROCESS_RESULT
字段
pro_code 其中 T_PROCESS_RESULT 要和T_WORK_PLAN 进行全外连接
所以借助于 VW_TSK 表请问这句SQL应该怎么写啊
1和2的tsk是否一一对应你也没说??
(select a.* ,b.* from vw_tsk a , T_PROCESS_RESULT b where a.pro_code=b.pre_code) c
left outer join T_WORK_PLAN d
on c.tsk=d.tsk
select t2.*
from T_PROCESS_RESULT t1,
(select a.tsk,b.*
from VW_TSK a, T_PROCESS_RESULT b
where a.pro_code=b.pro_code
) t2
where t1.tsk=t2.tsk
而且select a.* ,b.* from ...这步就要保证是全外连接。
(select a.* ,b.* from vw_tsk a , T_PROCESS_RESULT b where a.pro_code=b.pre_code) c
left outer join T_WORK_PLAN d
on c.tsk=d.tsk
OPER@tl>select * from test; AAA
----------
2
3OPER@tl>select * from test2; AAA BBB
---------- ----------
2 2
3 3OPER@tl>select * from test3; BBB
----------
1
2OPER@tl>select c.aaa,d.*
2 from (
3 select a.aaa,b.bbb
4 from test a,test2 b
5 where a.aaa=b.aaa) c
6 full outer join test3 d
7 on (c.bbb=d.bbb); AAA BBB
---------- ----------
2 2
3
1
谢谢了哈哈.....SELECT
count(*)
FROM
T_WORK_PLAN a FULL OUTER JOIN VW_TSK c ON(a.TSK = c.TSK) ,T_PROCESS_RESULT b
where b.proc_code = c.proc_code
这个和你的有什么不同啊??
谢谢了哈哈.....SELECT
count(*)
FROM
T_WORK_PLAN a FULL OUTER JOIN VW_TSK c ON(a.TSK = c.TSK) ,T_PROCESS_RESULT b
where b.proc_code = c.proc_code
这个和你的有什么不同啊??