Reading data from several tables
We have several possibilities for reading data from several tables in SQL and merging that data in one internal table. I will present three possibilities for getting the data from several tables into one internal table. Here, we can use FOR ALL ENTRIES
, SELECT...ENDSELECT
, and JOIN
. As the mechanism and principle of the FOR ALL ENTRIES
operation has been discussed previously, I have only shown how to get data from several tables.
We need to split a query into two SELECT
statements. However, first of all, I will prepare the structure and table when we have fields from two tables—sflight
and spfli
:
TYPES: BEGIN OF s_for_all_entries, mandt TYPE mandt, carrid TYPE s_carr_id, connid TYPE s_conn_id, fldate TYPE s_date, countryfr TYPE land1, cityfrom TYPE s_from_cit, airpfrom TYPE s_fromairp, countryto TYPE land1, cityto TYPE s_to_city, airpto TYPE s_toairp, END OF s_for_all_entries. DATA: gt_for_all_enties...