Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

using 2 tables

Former Member
0 Kudos
100

i hv to use 3 fields ....but 2 fields r in table-1 and 3rd field is in table-2

so what would b the select query for this.................

2 REPLIES 2

former_member156446
Active Contributor
0 Kudos
34

select using Inner joins

SELECT d~aufnr d~qmnum a~aufpl a~pernr a~steus " flg_kmp
a~larnt a~anzzl a~preis a~waers
a~matkl a~ekgrp a~ekorg a~lifnr a~ltxa1 a~banfn a~bnfpo
b~arbeh b~daune b~dauno b~mgvrg b~meinh
c~packno c~sub_packno c~srvpos
a~sakto c~netwr a~vornr
c~menge c~meins d~auart
INTO TABLE lt_all
FROM viaufkst AS d INNER JOIN
afvc AS a ON
d~aufpl = a~aufpl
INNER JOIN afvv AS b
ON a~aufpl = b~aufpl AND
a~aplzl = b~aplzl
INNER JOIN esll AS c
ON c~packno EQ a~packno
FOR ALL ENTRIES IN lt_viau
WHERE d~aufnr = lt_viau-aufnr AND
d~aufpl = lt_viau-aufpl AND
d~auart = lt_viau-auart.

Former Member
0 Kudos
34

SELECT t1field1 t2field1 t1~field3

INTO TABLE itab

FROM t1

inner JOIN t2 ON t1<field> = t2<field>.