Application Development and Automation 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: 
Read only

JOIN (INNEER JOIN)

Neithan
Participant
0 Likes
1,934

Hi everyone ,

How to pull data from 3 tables or multiple tables with a single join .If you have an example and I would appreciate it if you could show it .

Thanks advance .

Hi everyone ,

How to pull data from 3 tables or multiple tables with a single join .If you have an example and I would appreciate it if you could show it .

Thanks advance .

6 REPLIES 6
Read only

FredericGirod
Active Contributor
1,682

If you have 3 tables you need two joins

[TABLE1] Join [TABLE2] Join [TABLE3] otherwise how to link them ?

(but in one statement it is possible)

Read only

former_member9115
Participant
1,682

Hi,

https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapselect_join.htm

Simple example:
select a~belnr , a~gjahr , b~zuonr, c~text
from table1 as a
inner join table2 as b on b~belnr= a~belnr and b~gjahr = a~gjahr
inner join table3 as c on c~belnr= a~belnr and c~gjahr = a~gjahr

where b~condition = x
and a~condition = y.
Read only

0 Likes
1,682

Thank you !

Read only

NemanjaSimovic
Active Participant
0 Likes
1,682

Hi Furkan,

Below is some practical open SQL that you can run. Tables are already there. It involves Plant, Valuation Area and Company code. They relation is 1:1:1 so it is easy to follow.

select pl~werks, pl~name1, pl~land1 as land1_plant,
va~bwkey, cc~bukrs, cc~butxt as company_code_name,
cc~land1 as land1_company_code
from t001w as pl " Plant
join t001k as va on va~bwkey = pl~bwkey " Valuation Area
join t001 as cc on cc~bukrs = va~bukrs " Company Code

Regards,
Nemanja

Read only

0 Likes
1,682

Thank you for your response

Read only

matt
Active Contributor
0 Likes
1,682

Just use UNION twice.