Ansicht
Dokumentation

ABENJOINS_ABEXA - JOINS ABEXA

ABENJOINS_ABEXA - JOINS ABEXA

ROGBILLS - Synchronize billing plans   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.
SAP E-Book

SELECT, Inner, Outer, and Cross Joins

This example demonstrates inner and outer joins as well as cross joins in the SELECT statement.

Source Code

Execute

Description

Inner and outer joins between two tables DEMO_JOIN1 and DEMO_JOIN2, for which the last column of DEMO_JOIN1 matches the first column of DEMO_JOIN2 in the join conditions.

  • Both inner joins between the tables produce the same result set, regardless of how they are arranged on the left or the right. Three row combinations meet the join condition.
  • The result sets of the two left joins depends on the arrangement of the tables on the left and right side. Apart from the three rows already produced by the inner join, an empty row (actually null values) is created on the right for each surplus row on the left. The fact that the empty row is displayed on the left in the final result is due to the structure of the internal table in the INTO clause. Here, the columns of DEMO_JOIN1 are always read from the left and those of DEMO_JOIN2 are always read from the right. If * was specified in the SELECT list, and CORRESPONDING FIELDS was not used in the INTO clause, the result would be arranged differently.
  • The result sets of both right outer joins exactly correspond to the result sets of both previous left outer joins with the DDIC database tables specified in reverse order.
  • The result sets of both cross joins without a WHERE condition are identical to the result sets of the corresponding inner and outer joins whose ON condition is always true. It makes no difference which side the data sources are specified on in the cross join. The number of rows is determined by 4 x 3 = 12.
  • The result set of the cross join with a WHERE condition is identical to the result set of an inner join with a corresponding ON condition. It should be noted that in a cross join, all rows are read first and then selected, whereas the inner join only reads the rows that meet the conditions.

See also the executable example SQL Expressions, Coalesce Function, in which the default initial values set for the null values in the outer join are replaced by a different value.






BAL_S_LOG - Application Log: Log header data   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

Length: 2792 Date: 20240425 Time: 014623     sap01-206 ( 56 ms )