Skip to Content
2
Former Member
Jul 03, 2007 at 12:45 PM

Inner and outer Joins

30 Views

Hi

I have three tables that i want link. I want to return values from table ISEG even if data does not exist in MSEG and MKPF.

Currently no data are returned when data in mkpf does not exists. I've joined mseg and mkpf with a inner join.

  SELECT a~matnr a~werks  SUM( a~menge ) SUM( a~buchm ) SUM( b~menge )                                                                                
INTO  TABLE wa_outtab
      FROM iseg AS a
      LEFT OUTER JOIN mseg AS b
          ON    b~matnr = a~matnr
      INNER JOIN  mkpf AS c
          ON    c~mblnr =   b~mblnr      AND 
                   c~mjahr =   b~mjahr      AND
                                                                                c~bldat >=  idate-low     AND
                   c~bldat <=  idate-high
       WHERE
        a~iblnr IN iblnr 
           GROUP BY   a~matnr a~werks .