Ansicht
Dokumentation

ABENJOIN_JOINS_ABEXA - JOIN JOINS ABEXA

ABENJOIN_JOINS_ABEXA - JOIN JOINS ABEXA

CL_GUI_FRONTEND_SERVICES - Frontend Services   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

SELECT, Multiple Joins

This example demonstrates chaining and parenthesizing of multiple joins in the SELECT statement.

Source Code

Execute

Description

Chaining of up to four DDIC database tables using inner, outer, and cross joins.

  1. Inner join between tables DEMO_JOIN1 and DEMO_JOIN2. The result set contains three rows, in which column D of DEMO_JOIN1 has the same content as column D of DEMO_JOIN2.
  2. Inner join between tables DEMO_JOIN3 and DEMO_JOIN4. The result set contains three rows, in which column L of DEMO_JOIN3 has the same content as column L of DEMO_JOIN4.
  3. Outer join between result set of point 1 and table DEMO_JOIN3. The result set contains three rows. In addition to the row in which column L of DEMO_JOIN3 and column D of DEMO_JOIN2 from the result set of point 1 have the same content, there are two rows in which the columns of DEMO_JOIN3 are filled with null values, since they do not meet the join condition. In variant 3b, explicit parentheses are used to visualize the implicit parentheses in variant 3a.
  4. Inner join between result set of point 3 and table DEMO_JOIN4. The result set contains a row in which column L of DEMO_JOIN4 has the same content as column L of DEMO_JOIN3 from the result set of point 3. In variant 4b, explicit parentheses are used to visualize the implicit parentheses in variant 4a.
  5. Outer join between the result set of point 1 and result set of point 2. The result set contains three rows. In addition to the row in which column L ofDEMO_JOIN3 from the result set of point 2 and column D of DEMO_JOIN2 from the result set of point 1 have the same content, there are two rows in which the columns from the result set of point 2 are filled with null values, since they do not meet the join condition. In variant 5b, explicit parentheses are used to visualize the implicit parentheses in variant 5a.
  6. Cross joins between the tables DEMO_JOIN1, DEMO_JOIN2, and DEMO_JOIN3. The result set is not determined by the order of the evaluation defined by the parentheses. The number of rows is determined by 4 x 3 x 3 = 36.
  7. Combinations of a cross join with a right outer join executed in different orders.
  • The parenthesis in variant 7b matches the implicit order of variant 7a. The cross join is evaluated first, and its result set is joined with the DDIC database table DEMO_JOIN3 using the right outer join.

  • The parentheses in variant 7c produce a different result. A cross join is created between DEMO_JOIN1 and the result set of the right outer join between DEMO_JOIN2 and DEMO_JOIN3. The number of rows is calculated from 4 x 3 x 12 = 36.






Addresses (Business Address Services)   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 3821 Date: 20240426 Time: 132911     sap01-206 ( 79 ms )