02-10-2022 12:17 PM
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 .
02-10-2022 12:30 PM
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)
02-10-2022 12:30 PM
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.
02-10-2022 4:19 PM
02-10-2022 8:35 PM
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
02-11-2022 5:48 PM
02-14-2022 6:00 PM