I'm new in using SQL in ABAP, so it must be a silly question, but is this somehow possible?:
as I'm new, I cannot add images directly.
Thanks a lot in advance, kind regards
I'm new in using SQL in ABAP, so it must be a silly question, but is this somehow possible?:
as I'm new, I cannot add images directly.
Thanks a lot in advance, kind regards
It appears that what you want to do is create an SQL "Union": Select rows from two different database tables and put the results into one combined table. This is only possible if both SELECTs have the same fields. But you can usually accomplish that pretty easily by substituting the missing rows in each table by a constant value (''
in this example):
SELECT
key1
'' as key2
value1
value2
value3
'' as value4
FROM db1
UNION SELECT
key1
key2
value1
'' as value2
'' as value3
value4
FROM db2
INTO CORRESPONDING FIELDS OF TABLE @it.
When you are using an older release (<7.50), then you can combine the data of multiple SELECTs by using APPENDING
instead of INTO
:
SELECT
key1
value1
value2
value3
FROM db1
INTO CORRESPONDING FIELDS OF TABLE @it.
SELECT
key1
key2
value1
value4
FROM db2
APPENDING CORRESPONDING FIELDS OF TABLE @it.