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: 

Which table should be considered to be right and which table should be considered to be left ?

BODHISATTWA__20
Participant
0 Kudos

While creating a CDS view , be it left outer join or right or right outer join, what is the rule of thumb to decide which table should be considered to be right and which table should be considered to be right and which table should be considered to be left ?

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor

I guess your question is: "what is left outer join?" (with the answer you will deduce easily what is right outer join).

This question is very frequent on internet.

Anyway, I found this blog post useful to understand what is an inner join and what is the left outer join: https://blogs.sap.com/2015/04/07/join-types-sap-queries/

5 REPLIES 5

Sandra_Rossi
Active Contributor

I guess your question is: "what is left outer join?" (with the answer you will deduce easily what is right outer join).

This question is very frequent on internet.

Anyway, I found this blog post useful to understand what is an inner join and what is the left outer join: https://blogs.sap.com/2015/04/07/join-types-sap-queries/

ChrisSolomon
Active Contributor
select * from TABLE1 join on TABLE2..


Sooooo you tell me which one is on the right of the join and which is on the left....THAT is your answer. 😃

singloob
Explorer
0 Kudos

I think the rule of thumbs is, Primary source placed on the Left, while Secondary source placed on the right.

former_member1716
Active Contributor
0 Kudos

bodhisattwa.pal2,

In addition to the points mentioned by Sandra Rossi,

To understand which table to be placed at left or right you first need to have a deep knowledge of all the Joins. From here It all depends on the fields you are intended to fetch from the tables.

Mainly your business scenario will matter to make the decision on the same. I would recommend you to do the following exercise.

Select any Two tables, write different select queries applying all types of Joins also by toggling the tables at left/right. See the different results you received, now try to frame a business scenario when would business need such a result.

Above exercise is only for practice, the more you practice the better you will get to know the concepts.

All the Best!!! Cheers!

Regards!

sdsunny372
Active Participant

Hi Bodhisattwa,

Decide your base table as per your requirement , and it will be your left table in any join.

Best regards,

Sagarkumar Darji