<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: outer join and inner join in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/outer-join-and-inner-join/m-p/3986064#M952259</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here the sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of t_mara occurs 0,&lt;/P&gt;&lt;P&gt;      matnr type matnr,&lt;/P&gt;&lt;P&gt;      maktx type maktx,&lt;/P&gt;&lt;P&gt;      end of t_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;matnr b&lt;/SUB&gt;maktx&lt;/P&gt;&lt;P&gt;       into table t_mara&lt;/P&gt;&lt;P&gt;       from ( mara as a inner join makt as b&lt;/P&gt;&lt;P&gt;       on a&lt;SUB&gt;matnr = b&lt;/SUB&gt;matnr ) up to 100 rows&lt;/P&gt;&lt;P&gt;       where b~spras = 'E'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_mara.&lt;/P&gt;&lt;P&gt;write:/ t_mara-matnr, t_mara-maktx.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;matnr b&lt;/SUB&gt;maktx&lt;/P&gt;&lt;P&gt;       into table t_mara&lt;/P&gt;&lt;P&gt;       from ( mara as a left outer join makt as b&lt;/P&gt;&lt;P&gt;       on a&lt;SUB&gt;matnr = b&lt;/SUB&gt;matnr ) up to 100 rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip 3.&lt;/P&gt;&lt;P&gt;loop at t_mara.&lt;/P&gt;&lt;P&gt;write:/ t_mara-matnr, t_mara-maktx.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the left outer join should not be in the where condition.&lt;/P&gt;&lt;P&gt;I is very simple and can be used for other tables. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Saravanan V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Jun 2008 16:30:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-19T16:30:03Z</dc:date>
    <item>
      <title>outer join and inner join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/outer-join-and-inner-join/m-p/3986062#M952257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can anyone send me a simple stmt using outer join and inner join separately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i need it at the earliest to use in my report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;full points for helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2008 15:43:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/outer-join-and-inner-join/m-p/3986062#M952257</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-19T15:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: outer join and inner join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/outer-join-and-inner-join/m-p/3986063#M952258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Venkat,&lt;/P&gt;&lt;P&gt;Check below code for inner join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
     SELECT a~vbeln
             a~fkart     a~vbtyp a~vkorg
             a~erdat a~zuonr   b~posnr b~meins
             b~fklmg b~ntgew b~gewei b~matnr b~vkbur
             FROM vbrk AS a INNER JOIN vbrp AS b
             ON a~vbeln  EQ b~vbeln
             WHERE a~vbtyp NE lc_n
             AND   a~vbtyp NE lc_o
             AND   a~vbtyp NE lc_u  
             AND   b~erdat IN r_erdat
             AND   a~erdat IN r_erdat
             AND   b~aland EQ c_aland.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will fetch all the invoices which satisfies the above WHERE clause conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here a means VBRK and b means VBRP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically INNER JOIN will select matched records of the join tables.(i.e Intersection of the join tables)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Outer join has two types LEFT and RIGHT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LEFT OUETR JOIN will fetch Left union and RIGHT OUTER JOIN will fetch RIGHT union.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg: Left table is A and right table is B then LEFT OUTER JOIN will give ALL records that matches where clause for table A and matched records of B. Right OUTER JOIN will give all records of B which matches where claause for table B and matched records of A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it is clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Vinod Reddy Vemuru on Jun 19, 2008 9:41 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2008 16:10:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/outer-join-and-inner-join/m-p/3986063#M952258</guid>
      <dc:creator>vinod_vemuru2</dc:creator>
      <dc:date>2008-06-19T16:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: outer join and inner join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/outer-join-and-inner-join/m-p/3986064#M952259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here the sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of t_mara occurs 0,&lt;/P&gt;&lt;P&gt;      matnr type matnr,&lt;/P&gt;&lt;P&gt;      maktx type maktx,&lt;/P&gt;&lt;P&gt;      end of t_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;matnr b&lt;/SUB&gt;maktx&lt;/P&gt;&lt;P&gt;       into table t_mara&lt;/P&gt;&lt;P&gt;       from ( mara as a inner join makt as b&lt;/P&gt;&lt;P&gt;       on a&lt;SUB&gt;matnr = b&lt;/SUB&gt;matnr ) up to 100 rows&lt;/P&gt;&lt;P&gt;       where b~spras = 'E'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_mara.&lt;/P&gt;&lt;P&gt;write:/ t_mara-matnr, t_mara-maktx.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;matnr b&lt;/SUB&gt;maktx&lt;/P&gt;&lt;P&gt;       into table t_mara&lt;/P&gt;&lt;P&gt;       from ( mara as a left outer join makt as b&lt;/P&gt;&lt;P&gt;       on a&lt;SUB&gt;matnr = b&lt;/SUB&gt;matnr ) up to 100 rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip 3.&lt;/P&gt;&lt;P&gt;loop at t_mara.&lt;/P&gt;&lt;P&gt;write:/ t_mara-matnr, t_mara-maktx.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the left outer join should not be in the where condition.&lt;/P&gt;&lt;P&gt;I is very simple and can be used for other tables. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Saravanan V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2008 16:30:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/outer-join-and-inner-join/m-p/3986064#M952259</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-19T16:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: outer join and inner join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/outer-join-and-inner-join/m-p/3986065#M952260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data that can be selected with a view depends primarily on whether the view implements an inner join or an outer join. With an inner join, you only get the records of the cross-product for which there is an entry in all tables used in the view. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With an outer join, records are also selected for which there is no entry in some of the tables used in the view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg for inner join.&lt;/P&gt;&lt;P&gt;SELECT A&lt;SUB&gt;EBELN A&lt;/SUB&gt;LIFNR A&lt;SUB&gt;KNUMV B&lt;/SUB&gt;EBELP B&lt;SUB&gt;NETWR B&lt;/SUB&gt;NETPR B&lt;SUB&gt;WERKS B&lt;/SUB&gt;MATNR &lt;/P&gt;&lt;P&gt;  L&lt;SUB&gt;NAME1 L&lt;/SUB&gt;NAME2 &lt;/P&gt;&lt;P&gt;  FROM EKKO AS A &lt;/P&gt;&lt;P&gt;  INNER JOIN EKPO AS B ON A&lt;SUB&gt;EBELN = B&lt;/SUB&gt;EBELN &lt;/P&gt;&lt;P&gt;  INNER JOIN LFA1 AS L ON L&lt;SUB&gt;LIFNR = A&lt;/SUB&gt;LIFNR &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;INNER JOIN EKKN AS C ON C&lt;SUB&gt;EBELN = A&lt;/SUB&gt;EBELN &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE itab &lt;/P&gt;&lt;P&gt;  WHERE B~BUKRS = 'company code' . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg for outer join&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: CUSTOMER TYPE SCUSTOM,  &lt;/P&gt;&lt;P&gt;      BOOKING  TYPE SBOOK.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SCUSTOM&lt;SUB&gt;NAME SCUSTOM&lt;/SUB&gt;POSTCODE SCUSTOM~CITY  &lt;/P&gt;&lt;P&gt;       SBOOK&lt;SUB&gt;FLDATE SBOOK&lt;/SUB&gt;CARRID SBOOK&lt;SUB&gt;CONNID SBOOK&lt;/SUB&gt;BOOKID  &lt;/P&gt;&lt;P&gt;       INTO (CUSTOMER-NAME, CUSTOMER-POSTCODE, CUSTOMER-CITY,  &lt;/P&gt;&lt;P&gt;             BOOKING-FLDATE, BOOKING-CARRID, BOOKING-CONNID,  &lt;/P&gt;&lt;P&gt;             BOOKING-BOOKID)  &lt;/P&gt;&lt;P&gt;       FROM SCUSTOM LEFT OUTER JOIN SBOOK  &lt;/P&gt;&lt;P&gt;         ON SCUSTOM&lt;SUB&gt;ID = SBOOK&lt;/SUB&gt;CUSTOMID AND  &lt;/P&gt;&lt;P&gt;            SBOOK~FLDATE = '20081015'  &lt;/P&gt;&lt;P&gt;       ORDER BY SCUSTOM&lt;SUB&gt;NAME SBOOK&lt;/SUB&gt;FLDATE.  &lt;/P&gt;&lt;P&gt;  WRITE: / CUSTOMER-NAME, CUSTOMER-POSTCODE, CUSTOMER-CITY,  &lt;/P&gt;&lt;P&gt;           BOOKING-FLDATE, BOOKING-CARRID, BOOKING-CONNID,  &lt;/P&gt;&lt;P&gt;           BOOKING-BOOKID.  &lt;/P&gt;&lt;P&gt;ENDSELECT.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls reward if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 01:26:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/outer-join-and-inner-join/m-p/3986065#M952260</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T01:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: outer join and inner join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/outer-join-and-inner-join/m-p/3986066#M952261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Conceptually :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;inner join : The inner join joins the columns of every selected line on the left- hand side with the columns of all lines on the right-hand side that jointly fulfil the join_cond condition. A line in the resulting set is created for every such line on the right-hand side. The content of the column on the left-hand side may be duplicated in this case. If none of the lines on the right-hand side fulfils the join_cond condition, no line is created in the resulting set. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;outer join : The outer join basically creates the same resulting set as the inner join, with the difference that at least one line is created in the resulting set for every selected line on the left-hand side, even if no line on the right-hand side fulfils the join_cond condition. The columns on the right-hand side that do not fulfil the join_cond condition are filled with null values. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: Inner Join:&lt;/P&gt;&lt;P&gt;===============&lt;/P&gt;&lt;P&gt;SELECT c&lt;SUB&gt;carrname p&lt;/SUB&gt;connid f~fldate &lt;/P&gt;&lt;P&gt;       INTO CORRESPONDING FIELDS OF TABLE itab &lt;/P&gt;&lt;P&gt;       FROM ( ( scarr AS c &lt;/P&gt;&lt;P&gt;         INNER JOIN spfli AS p ON p&lt;SUB&gt;carrid   = c&lt;/SUB&gt;carrid &lt;/P&gt;&lt;P&gt;                              AND p~cityfrom = p_cityfr &lt;/P&gt;&lt;P&gt;                              AND p~cityto   = p_cityto ) &lt;/P&gt;&lt;P&gt;         INNER JOIN sflight AS f ON f&lt;SUB&gt;carrid = p&lt;/SUB&gt;carrid &lt;/P&gt;&lt;P&gt;                                AND f&lt;SUB&gt;connid = p&lt;/SUB&gt;connid ). &lt;/P&gt;&lt;P&gt;=================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example of : Left outer join:&lt;/P&gt;&lt;P&gt;==================&lt;/P&gt;&lt;P&gt;SELECT s&lt;SUB&gt;carrid s&lt;/SUB&gt;carrname p~connid &lt;/P&gt;&lt;P&gt;       INTO CORRESPONDING FIELDS OF TABLE itab &lt;/P&gt;&lt;P&gt;       FROM scarr AS s &lt;/P&gt;&lt;P&gt;       LEFT OUTER JOIN spfli AS p ON s&lt;SUB&gt;carrid   =  p&lt;/SUB&gt;carrid &lt;/P&gt;&lt;P&gt;                                  AND p~cityfrom = p_cityfr. &lt;/P&gt;&lt;P&gt;==================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 07:44:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/outer-join-and-inner-join/m-p/3986066#M952261</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T07:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: outer join and inner join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/outer-join-and-inner-join/m-p/3986067#M952262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks alot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 09:27:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/outer-join-and-inner-join/m-p/3986067#M952262</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T09:27:47Z</dc:date>
    </item>
  </channel>
</rss>

