sommererdbeere
Programmer
hi,
i have problems running the oracle sql below. i wanna do outter join for many to many cases. let say (an example), in database, i have
cust trans
1A 1A
2B 2B
2B
3C
by using the UNION ALL operator and NOT IN, i wanna get the result above for both side like cust = trans(+) and cust(+) = trans => cust(+) = trans(+)
however, i cannot use this in sql.. can anyone have any advice on to how to approach on this? many many many thanks.. i try to figure out this for 2 days already, still can't find any solution.. the following is what i had:
Select
a.ord trans_ord,
a.ptno trans_ptno,
b.transco transco,
c.ptno join_ptno,
c.state join_state,
b.size size,
acc_API.GET_ACCYEA(b.ACCID,1) accyea,
acc_API.GET_ACCPER(b.ACCID,1) accper,
COST_API.Get_Cost('america', b.ptno, '1', '*', '*') cost,
e.CID cid,
e.ADDID addid,
e.reg addr_reg_code,
c.ord join_ord,
c.cn c_cust_no,
c.pay pay,
From (
select * from (select b.ord t_ord,b.ptno t_ptno from
inv_his b
where (b.ord,b.ptno) not in (select c.ord, c.ptno from cusj c)
union all
select c.ord ord,c.ptno ptno from cusj c
) a, cusj c, custadd e
where b.ord = c.ord and
c.ptno = b.ptno (+) and
e.cID = c.cn and
e.aID = c.sh and
b.transcode= 'mail' and
c.CON='america' and c.ORD_I = 'yes' and
c.state != 'Cancelled'and
(upper( c.ORD ) not like upper( 'kr1%' ) and
upper( c.ORD ) not like upper( 'er2%' ) and
upper( c.ORD ) not like upper( 'TW3%' ) and
)
please be advice. many many many thanks..
somm
i have problems running the oracle sql below. i wanna do outter join for many to many cases. let say (an example), in database, i have
cust trans
1A 1A
2B 2B
2B
3C
by using the UNION ALL operator and NOT IN, i wanna get the result above for both side like cust = trans(+) and cust(+) = trans => cust(+) = trans(+)
however, i cannot use this in sql.. can anyone have any advice on to how to approach on this? many many many thanks.. i try to figure out this for 2 days already, still can't find any solution.. the following is what i had:
Select
a.ord trans_ord,
a.ptno trans_ptno,
b.transco transco,
c.ptno join_ptno,
c.state join_state,
b.size size,
acc_API.GET_ACCYEA(b.ACCID,1) accyea,
acc_API.GET_ACCPER(b.ACCID,1) accper,
COST_API.Get_Cost('america', b.ptno, '1', '*', '*') cost,
e.CID cid,
e.ADDID addid,
e.reg addr_reg_code,
c.ord join_ord,
c.cn c_cust_no,
c.pay pay,
From (
select * from (select b.ord t_ord,b.ptno t_ptno from
inv_his b
where (b.ord,b.ptno) not in (select c.ord, c.ptno from cusj c)
union all
select c.ord ord,c.ptno ptno from cusj c
) a, cusj c, custadd e
where b.ord = c.ord and
c.ptno = b.ptno (+) and
e.cID = c.cn and
e.aID = c.sh and
b.transcode= 'mail' and
c.CON='america' and c.ORD_I = 'yes' and
c.state != 'Cancelled'and
(upper( c.ORD ) not like upper( 'kr1%' ) and
upper( c.ORD ) not like upper( 'er2%' ) and
upper( c.ORD ) not like upper( 'TW3%' ) and
)
please be advice. many many many thanks..
somm