2006 Dec 01 12:09 PM
Hello, my problem is that I don't know how retrieve the not common fields between two tables.
EG:
TABA
field1 field2 field3 field4
TABB
field1 field2 field4
I only want retrieve the field "field3", how can I do it?
Any adding with LEFT OUTER JOIN?
Thanks in advance.
2006 Dec 01 12:13 PM
hi,
chk this ample.
table : emp
empno name
a sasi
b xxx
c yyy
table : sal
empno salary
a 1000
b 2000
Inner join
****************
select eempno ename
s~sal
into table int_table
from emp as e
inner join sal
on
eempno = sempno.
if you made inner join between table a and b by emp no
the selection retrives only if the condition satisfy the output will be
a sasi 1000
b xxx 2000
Outer join
*************************
select eempno ename
s~sal into table int_table
from emp as e
LEFT OUTER JOIN sal
on
eempno = sempno.
if you made outer join (left /right ) the left table kept as it is the
if the condition satisfy the right table entries will fetch else leave it blank
the output will be
a sasi a 1000
b xxx b 2000
c yyy
rgds
Anver
2006 Dec 01 12:13 PM
hi,
chk this ample.
table : emp
empno name
a sasi
b xxx
c yyy
table : sal
empno salary
a 1000
b 2000
Inner join
****************
select eempno ename
s~sal
into table int_table
from emp as e
inner join sal
on
eempno = sempno.
if you made inner join between table a and b by emp no
the selection retrives only if the condition satisfy the output will be
a sasi 1000
b xxx 2000
Outer join
*************************
select eempno ename
s~sal into table int_table
from emp as e
LEFT OUTER JOIN sal
on
eempno = sempno.
if you made outer join (left /right ) the left table kept as it is the
if the condition satisfy the right table entries will fetch else leave it blank
the output will be
a sasi a 1000
b xxx b 2000
c yyy
rgds
Anver
2006 Dec 01 12:16 PM
select a~field3 into itab from taba inner join tabb where taba-field = tabb-field and (other key options).
2006 Dec 01 12:19 PM
Hi,
U may create another ITAB for the uncommon fields and try the following.
Loop at TABA into LW_TABA.
read table TABB with key LW_TABA -field1 = field1
LW_TABA -field2 = field2.
IF sy-subrc <> 0. "If not found then move
move TABA-field3 to ITABC-field3.
append ITABC.
ENDIF.
Endloop.
If helpful pl reward.
Cheers.
2006 Dec 01 12:22 PM
table : emp
empno name
a sasi
b xxx
c yyy
table : sal
empno salary
a 1000
b 2000
I don't want this output, I only want de different register.
a sasi a 1000
b xxx b 2000
c yyy
I want mean this:
c yyy
Thanks for your help.
2006 Dec 01 12:23 PM
hi,
try this.
[code]
1. pick all data from taba to itab1
2. pick all data from tabb to itab2.
3. loop at itab1.
read table itab2 with ur key.
if sy-subrc <> 0. "not found
append to a final itab
endif.
4. in final itab u will get required data
code]
rgds
Anver
2006 Dec 01 12:29 PM
try this.
1. pick all data from taba to itab1
2. pick all data from tabb to itab2.
3. loop at itab1.
read table itab2 with ur key.
if sy-subrc <> 0. "not found
append to a final itab
endif.
4. in final itab u will get required data
2006 Dec 01 12:48 PM