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: 

JOIN (INNEER JOIN)

frknkzlrsln
Participant
0 Kudos

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

FredericGirod
Active Contributor

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)

former_member9115
Participant

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.

0 Kudos

Thank you !

NemanjaSimovic
Participant
0 Kudos

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

0 Kudos

Thank you for your response

matt
Active Contributor
0 Kudos

Just use UNION twice.