Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8653

Re: Read from 6 tables, create 1 file

$
0
0

Hi Zach,

 

In case you want to pull out the entries even if there are no entries in ADR6 or ADRC etc then you can use the LEFT OUTER JOIN as per your requirement.

 

for e.g. in the below example even if the ADR6 and AUSP table has no records with respect to other tables still the records would be pulled out from the rest of the tables and the query would return the rest of the fields in ITAB as empty.

 

SELECT KNA1~KUNNR KNA1~LAND1 KNA1~NAME1 KNA1~NAME2 KNA1~ORT01 KNA1~PSTLZ KNA1~REGIO KNA1~STRAS KNA1~TELF1 KNA1~ADRNR KNVV~VKORG KNVV~VTWEG KNVV~SPART KNVV~INCO1 KNVV~INCO2 KNVV~ZTERM KNVP~PARVW KNVP~PARZA KNVP~KUNN2 KNVP~LIFNR KNVP~PERNR KNVP~PARNR KNVP~KNREF KNVP~DEFPA AUSP~OBJEK AUSP~ATINN AUSP~ATZHL AUSP~MAFID AUSP~KLART AUSP~ADZHL AUSP~ATWRT AUSP~AENNR AUSP~DATUV ADRC~ADDRNUMBER ADRC~DATE_FROM ADRC~NATION ADRC~CITY1 ADRC~CITY2 ADRC~CITY_CODE ADRC~CITYP_CODE ADR6~PERSNUMBER ADR6~CONSNUMBER ADR6~FLGDEFAULT ADR6~HOME_FLAG ADR6~SMTP_ADDR INTO CORRESPONDING FIELDS OF TABLE ITAB FROM KNA1 INNER JOIN KNVV ON KNA1~KUNNR = KNVV~KUNNR
   INNER JOIN KNVP ON KNA1~KUNNR = KNVP~KUNNR
   INNER JOIN ADRC ON KNA1~ADRNR = ADRC~ADDRNUMBER
   LEFT OUTER JOIN ADR6 ON KNA1~ADRNR = ADR6~ADDRNUMBER
   LEFT OUTER JOIN AUSP ON KNA1~KUNNR = AUSP~OBJEK.


Viewing all articles
Browse latest Browse all 8653

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>