<?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: JoinS in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570578#M257593</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi subhas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i posetd one earlier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;adding to that , a simple ex which will help u understand more&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chk this, very simple ex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table emp &lt;/P&gt;&lt;P&gt;empno name&lt;/P&gt;&lt;P&gt;a sasi&lt;/P&gt;&lt;P&gt;b xxx &lt;/P&gt;&lt;P&gt;c yyy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table sal&lt;/P&gt;&lt;P&gt;empno salary&lt;/P&gt;&lt;P&gt;a 1000&lt;/P&gt;&lt;P&gt;b 2000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inner join&lt;/P&gt;&lt;P&gt;****************&lt;/P&gt;&lt;P&gt;select e&lt;SUB&gt;empno e&lt;/SUB&gt;name &lt;/P&gt;&lt;P&gt;s~sal &lt;/P&gt;&lt;P&gt;into table int_table&lt;/P&gt;&lt;P&gt;from emp as e&lt;/P&gt;&lt;P&gt;inner join sal as s&lt;/P&gt;&lt;P&gt;on &lt;/P&gt;&lt;P&gt;e&lt;SUB&gt;empno = s&lt;/SUB&gt;empno.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you made inner join between table a and b by emp no &lt;/P&gt;&lt;P&gt;the selection retrives only if the condition satisfy the output will be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a sasi 1000&lt;/P&gt;&lt;P&gt;b xxx 2000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Outer join&lt;/P&gt;&lt;P&gt;*************************&lt;/P&gt;&lt;P&gt;select e&lt;SUB&gt;empno e&lt;/SUB&gt;name &lt;/P&gt;&lt;P&gt;s~sal into table  int_table&lt;/P&gt;&lt;P&gt;from emp as e&lt;/P&gt;&lt;P&gt;LEFT OUTER JOIN sal as s&lt;/P&gt;&lt;P&gt;on &lt;/P&gt;&lt;P&gt;e&lt;SUB&gt;empno = s&lt;/SUB&gt;empno.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you made outer join (left /right ) the left table kept as it is the &lt;/P&gt;&lt;P&gt;if the condition satisfy the right table entries will fetch else leave it blank&lt;/P&gt;&lt;P&gt;the output will be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a sasi a 1000&lt;/P&gt;&lt;P&gt;b xxx b 2000&lt;/P&gt;&lt;P&gt;c yyy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Sep 2006 10:08:22 GMT</pubDate>
    <dc:creator>anversha_s</dc:creator>
    <dc:date>2006-09-13T10:08:22Z</dc:date>
    <item>
      <title>JoinS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570570#M257585</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;What are the kind of JOINS that we normally use in a Select Query?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please explain me by giving a small example of 2 tables to make the picture clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2006 09:51:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570570#M257585</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-13T09:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: JoinS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570571#M257586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Info in help is good to understand better. Below is the &lt;/P&gt;&lt;P&gt;same for you understanding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;... FROM tabref1 [INNER] JOIN tabref2 ON cond 




Effect 
The data is to be selected from transparent database tables and/or views determined by tabref1 and tabref2. tabref1 and tabref2 each have the same form as in variant 1 or are themselves Join expressions. The keyword INNER does not have to be specified. The database tables or views determined by tabref1 and tabref2 must be recognized by the ABAP Dictionary. 



In a relational data structure, it is quite normal for data that belongs together to be split up across several tables to help the process of standardization (see relational databases). To regroup this information into a database query, you can link tables using the join command. This formulates conditions for the columns in the tables involved. The inner join contains all combinations of lines from the database table determined by tabref1 with lines from the table determined by tabref2, whose values together meet the logical condition (join condition) specified using ON&amp;gt;cond. 



Inner join between table 1 and table 2, where column D in both tables in the join condition is set the same: 



Table 1                      Table 2 
|----|----|----|----|        |----|----|----|----|----| 
| A  | B  | C  | D  |        | D  | E  | F  | G  | H  | 
|----|----|----|----|        |----|----|----|----|----| 
| a1 | b1 | c1 | 1  |        | 1  | e1 | f1 | g1 | h1 | 
| a2 | b2 | c2 | 1  |        | 3  | e2 | f2 | g2 | h2 | 
| a3 | b3 | c3 | 2  |        | 4  | e3 | f3 | g3 | h3 | 
| a4 | b4 | c4 | 3  |        |----|----|----|----|----| 
|----|----|----|----| 

                            / 
                           / 
                          / 
                         / 
                        / 
    Inner Join 
    |----|----|----|----|----|----|----|----|----| 
    | A  | B  | C  | D  | D  | E  | F  | G  | H  | 
    |----|----|----|----|----|----|----|----|----| 
    | a1 | b1 | c1 | 1  | 1  | e1 | f1 | g1 | h1 | 
    | a2 | b2 | c2 | 1  | 1  | e1 | f1 | g1 | h1 | 
    | a4 | b4 | c4 | 3  | 3  | e2 | f2 | g2 | h2 | 
    |----|----|----|----|----|----|----|----|----| 



Example 
Output a list of all flights from Frankfurt to New York between September 10th and 20th, 2001 that are not sold out: 



DATA: DATE   LIKE SFLIGHT-FLDATE, 
      CARRID LIKE SFLIGHT-CARRID, 
      CONNID LIKE SFLIGHT-CONNID. 

SELECT F~CARRID F~CONNID F~FLDATE 
    INTO (CARRID, CONNID, DATE) 
    FROM SFLIGHT AS F INNER JOIN SPFLI AS P 
           ON F~CARRID = P~CARRID AND 
              F~CONNID = P~CONNID 
    WHERE P~CITYFROM = 'FRANKFURT' 
      AND P~CITYTO   = 'NEW YORK' 
      AND F~FLDATE BETWEEN '20010910' AND '20010920' 
      AND F~SEATSOCC &amp;lt; F~SEATSMAX. 
  WRITE: / DATE, CARRID, CONNID. 
ENDSELECT. 



If there are columns with the same name in both tables, you must distinguish between them by prefixing the field descriptor with the table name or a table alias. 



Note 
In order to determine the result of a SELECT command where the FROM clause contains a join, the database system first creates a temporary table containing the lines that meet the ON condition. The WHERE condition is then applied to the temporary table. It does not matter in an inner join whether the condition is in the ON or WHEREclause. The following example returns the same solution as the previous one. 



Example 
Output of a list of all flights from Frankfurt to New York between September 10th and 20th, 2001 that are not sold out: 



DATA: DATE   LIKE SFLIGHT-FLDATE, 
      CARRID LIKE SFLIGHT-CARRID, 
      CONNID LIKE SFLIGHT-CONNID. 

SELECT F~CARRID F~CONNID F~FLDATE 
    INTO (CARRID, CONNID, DATE) 
    FROM SFLIGHT AS F INNER JOIN SPFLI AS P 
           ON F~CARRID = P~CARRID 
    WHERE F~CONNID = P~CONNID 
      AND P~CITYFROM = 'FRANKFURT' 
      AND P~CITYTO   = 'NEW YORK' 
      AND F~FLDATE BETWEEN '20010910' AND '20010920' 
      AND F~SEATSOCC &amp;lt; F~SEATSMAX. 
  WRITE: / DATE, CARRID, CONNID. 
ENDSELECT. 



Note 
Since not all of the database systems supported by SAP use the standard syntax for ON conditions, the syntax has been restricted. It only allows those joins that produce the same results on all of the supported database systems: 



Only a table or view may appear to the right of the JOIN operator, not another join expression. 

Only AND is possible in the ON condition as a logical operator. 

Each comparison in the ON condition must contain a field from the right-hand table. 

If an outer join occurs in the FROM clause, all the ON conditions must contain at least one "real" JOIN condition (a condition that contains a field from tabref1 amd a field from tabref2. 



Note 
In some cases, '*' may be specified in the SELECT clause, and an internal table or work area is entered into the INTO clause (instead of a list of fields). If so, the fields are written to the target area from left to right in the order in which the tables appear in the FROM clause, according to the structure of each table work area. There can then be gaps between table work areas if you use an Alignment Request. For this reason, you should define the target work area with reference to the types of the database tables, not simply by counting the total number of fields. For an example, see below: 



Variant 3 
... FROM tabref1 LEFT [OUTER] JOIN tabref2 ON cond 




Effect 
Selects the data from the transparent database tables and/or views specified in tabref1 and tabref2. tabref1 und tabref2 both have either the same form as in variant 1 or are themselves join expressions. The keyword OUTER can be omitted. The database tables or views specified in tabref1 and tabref2 must be recognized by the ABAP-Dictionary. 



In order to determine the result of a SELECT command where the FROM clause contains a left outer join, the database system creates a temporary table containing the lines that meet the ON condition. The remaining fields from the left-hand table (tabref1) are then added to this table, and their corresponding fields from the right-hand table are filled with ZERO values. The system then applies the WHERE condition to the table. 



Left outer join between table 1 and table 2 where column D in both tables set the join condition: 



Table 1                      Table 2 
|----|----|----|----|        |----|----|----|----|----| 
| A  | B  | C  | D  |        | D  | E  | F  | G  | H  | 
|----|----|----|----|        |----|----|----|----|----| 
| a1 | b1 | c1 | 1  |        | 1  | e1 | f1 | g1 | h1 | 
| a2 | b2 | c2 | 1  |        | 3  | e2 | f2 | g2 | h2 | 
| a3 | b3 | c3 | 2  |        | 4  | e3 | f3 | g3 | h3 | 
| a4 | b4 | c4 | 3  |        |----|----|----|----|----| 
|----|----|----|----| 

                            / 
                           / 
                          / 
                         / 
                        / 
    Left Outer Join 
    |----|----|----|----|----|----|----|----|----| 
    | A  | B  | C  | D  | D  | E  | F  | G  | H  | 
    |----|----|----|----|----|----|----|----|----| 
    | a1 | b1 | c1 | 1  | 1  | e1 | f1 | g1 | h1 | 
    | a2 | b2 | c2 | 1  | 1  | e1 | f1 | g1 | h1 | 
    | a3 | b3 | c3 | 2  |NULL|NULL|NULL|NULL|NULL| 
    | a4 | b4 | c4 | 3  | 3  | e2 | f2 | g2 | h2 | 
    |----|----|----|----|----|----|----|----|----| 



Example 
Output a list of all custimers with their bookings for October 15th, 2001: 



DATA: CUSTOMER TYPE SCUSTOM, 
      BOOKING  TYPE SBOOK. 

SELECT SCUSTOM~NAME SCUSTOM~POSTCODE SCUSTOM~CITY 
       SBOOK~FLDATE SBOOK~CARRID SBOOK~CONNID SBOOK~BOOKID 
       INTO (CUSTOMER-NAME, CUSTOMER-POSTCODE, CUSTOMER-CITY, 
             BOOKING-FLDATE, BOOKING-CARRID, BOOKING-CONNID, 
             BOOKING-BOOKID) 
       FROM SCUSTOM LEFT OUTER JOIN SBOOK 
         ON SCUSTOM~ID = SBOOK~CUSTOMID AND 
            SBOOK~FLDATE = '20011015' 
       ORDER BY SCUSTOM~NAME SBOOK~FLDATE. 
  WRITE: / CUSTOMER-NAME, CUSTOMER-POSTCODE, CUSTOMER-CITY, 
           BOOKING-FLDATE, BOOKING-CARRID, BOOKING-CONNID, 
           BOOKING-BOOKID. 
ENDSELECT. 



If there are columns with the same name in both tables, you must distinguish between them by prefixing the field descriptor with the table name or using an alias. 



Note 
For the resulting set of a SELECT command with a left outer join in the FROM clause, it is generally of crucial importance whether a logical condition is in the ON or WHERE condition. Since not all of the database systems supported by SAP themselves support the standard syntax and semantics of the left outer join, the syntax has been restricted to those cases that return the same solution in all database systems: 



Only a table or view may come after the JOIN operator, not another join statement. 

The only logical operator allowed in the ON condition is AND. 

Each comparison in the ON condition must contain a field from the right-hand table. 

Comparisons in the WHERE condition must not contain a field from the right-hand table. 

The ON condition must contain at least one "real" JOIN condition (a condition in which a field from tabref1 as well as from tabref2 occurs). 



Note 
In some cases, '*' may be specivied as the field list in the SELECT clause, and an internal table or work area is entered in the INTO clause (instead of a list of fields). If so, the fields are written to the target area from left to right in the order in which the tables appear in the llen in der FROM clause, according to the structure of each table work area. There can be gaps between the table work areas if you use an Alignment Request. For this reason, you should define the target work area with reference to the types of the database tables, as in the following example (not simply by counting the total number of fields). 



Example 
Example of a JOIN with more than two tables: Select all flights from Frankfurt to New York between September 10th and 20th, 2001 where there are available places, and display the name of the airline. 


DATA: BEGIN OF WA, 
        FLIGHT TYPE SFLIGHT, 
        PFLI   TYPE SPFLI, 
        CARR   TYPE SCARR, 
      END OF WA. 

SELECT * INTO WA 
    FROM ( SFLIGHT AS F INNER JOIN SPFLI AS P 
             ON F~CARRID = P~CARRID AND 
                F~CONNID = P~CONNID ) 
           INNER JOIN SCARR AS C 
             ON F~CARRID = C~CARRID 
    WHERE P~CITYFROM = 'FRANKFURT' 
      AND P~CITYTO   = 'NEW YORK' 
      AND F~FLDATE BETWEEN '20010910' AND '20010920' 
      AND F~SEATSOCC &amp;lt; F~SEATSMAX. 
  WRITE: / WA-CARR-CARRNAME, WA-FLIGHT-FLDATE, WA-FLIGHT-CARRID, 
           WA-FLIGHT-CONNID. 
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2006 09:53:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570571#M257586</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-13T09:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: JoinS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570572#M257587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_erp2005/helpdata/en/cf/21ec77446011d189700000e8322d00/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_erp2005/helpdata/en/cf/21ec77446011d189700000e8322d00/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb39c4358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb39c4358411d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz reward  the point first time if  it  is useful :-)...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2006 09:55:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570572#M257587</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-13T09:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: JoinS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570573#M257588</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;Pls.search the forum for previous replies on this subject.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anway. you may also check this link..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ec77446011d189700000e8322d00/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ec77446011d189700000e8322d00/frameset.htm&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2006 09:58:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570573#M257588</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-13T09:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: JoinS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570574#M257589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Joins are of two types i.e. Inner and Outer joins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Inner Join&amp;lt;/b&amp;gt; : Also called equi joins it is widely used in select query to join two tables. It joins the two tables and retrieves the record where the field exists in both the tables. Example...join between mara and vbap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;select vbap&lt;SUB&gt;matnr mara&lt;/SUB&gt;extwg&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;from vbap inner join mara on vbap&lt;SUB&gt;matnr = mara&lt;/SUB&gt;matnr.&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here in the above example it joins the tables on material number and would get the required information from both tables where the material exists in mara as well as vbap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Outer Join : The ones used are LEFT joins where it would fetch the all the data from the left table even if the correspend match does not exist in the other table. Example : We need to list all material from mara as well as fetch the corresponding sales order for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT mara&lt;SUB&gt;matnr vbap&lt;/SUB&gt;vbeln vbap~posnr&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;from mara left join vbap on mara&lt;SUB&gt;matnr = vbap&lt;/SUB&gt;matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above it would fetch all material information from mara irrespective if the order exists or not.&lt;/P&gt;&lt;P&gt;Please note in the above you cannot have where condition for fields from the other table(ex-VBAP).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Anurag Bankley&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2006 09:58:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570574#M257589</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-13T09:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: JoinS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570575#M257590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    joins are of two types &lt;/P&gt;&lt;P&gt;      &amp;lt;b&amp;gt;inner join-&amp;gt;&amp;lt;/b&amp;gt; joins two tables to get common data&lt;/P&gt;&lt;P&gt;                   of both table&lt;/P&gt;&lt;P&gt;         &lt;/P&gt;&lt;P&gt;       table A        table b&lt;/P&gt;&lt;P&gt;       10 a           10 100&lt;/P&gt;&lt;P&gt;       20 b           20  200&lt;/P&gt;&lt;P&gt;        result of inner join will be&lt;/P&gt;&lt;P&gt;        &lt;/P&gt;&lt;P&gt;        10 a 100&lt;/P&gt;&lt;P&gt;        20 b 200     &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &amp;lt;b&amp;gt;outer join.&amp;lt;/b&amp;gt;-&amp;gt; selects all data from table a&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;       table A        table b&lt;/P&gt;&lt;P&gt;       10 a           10 100&lt;/P&gt;&lt;P&gt;       20 b           &lt;/P&gt;&lt;P&gt;   result of outer join will be&lt;/P&gt;&lt;P&gt;        &lt;/P&gt;&lt;P&gt;        10 a 100&lt;/P&gt;&lt;P&gt;        20 b      &lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Amole&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2006 09:58:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570575#M257590</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-13T09:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: JoinS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570576#M257591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi subhash,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;inner join.&lt;/P&gt;&lt;P&gt;*********************&lt;/P&gt;&lt;P&gt;inner join which means you are slecting entries from both tables only if it meets the codition that the secong table's field matches with the first table's field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ztable_numplant (table)&lt;/P&gt;&lt;P&gt;bill_number&lt;/P&gt;&lt;P&gt;plant_Number&lt;/P&gt;&lt;P&gt;price&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ztable_numdate (table )&lt;/P&gt;&lt;P&gt;bill_number&lt;/P&gt;&lt;P&gt;bill_date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg: SELECT a&lt;SUB&gt;bill_number a&lt;/SUB&gt;plant_Number b~bill_Date &lt;/P&gt;&lt;P&gt;INTO TABLE int_table&lt;/P&gt;&lt;P&gt;FROM ( ztable_numplant AS a&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;INNER JOIN&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;ztable_numdate AS b&lt;/P&gt;&lt;P&gt;ON a&lt;SUB&gt;bill_number = b&lt;/SUB&gt;bill_number ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;outer join.&lt;/P&gt;&lt;P&gt;***************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table a table b&lt;/P&gt;&lt;P&gt;empno name empno salary&lt;/P&gt;&lt;P&gt;a sasi a 1000&lt;/P&gt;&lt;P&gt;b xxx b 2000&lt;/P&gt;&lt;P&gt;c yyy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you made outer join (left /right ) the left table kept as it is the if the condition satisfy the right table entries will fetch else leave it blank&lt;/P&gt;&lt;P&gt;the output will be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a sasi a 1000&lt;/P&gt;&lt;P&gt;b xxx b 2000&lt;/P&gt;&lt;P&gt;c yyy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg: syntax&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;rgds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2006 09:58:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570576#M257591</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-09-13T09:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: JoinS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570577#M257592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; Inner join&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Select f~carrid f~connid f~fldate 
		into (carrid,connid,date)
		from sflight as f inner join spfli as p 	
		on f~carrid = p~carrid  and 
		     f~connid = p~connid.               
	  Write:/ carrid,connid,date.                    
	  Clear: sflight,spfli.
    Endselect.           &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; We get teh records that satisfies the conditions mentioned after ON keyword.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Outer Join or Left outer join&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select scustom~name scustom~city
            sbook~carrid sbook~bookid 
	  into (scustom-name, scustom-city,
	        sbook-bookid, sbook-carrid)
	  from scustom left outer join sbook  
	  on scustom~id    = sbook~customid and 
	        sbook~fldate = '19971015&amp;#146;.                       
    	           write:/ scustom-name,scustom-ity,
		          sbook-carrid,sbook-bookid.  
		clear: scustom,sbook.                                  
    endselect..
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; We get all the records from table Scustom. If data exists for the records in Sbook, then the fields will be populated else the fields of sbook will be null.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sailaja.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2006 09:58:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570577#M257592</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-13T09:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: JoinS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570578#M257593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi subhas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i posetd one earlier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;adding to that , a simple ex which will help u understand more&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chk this, very simple ex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table emp &lt;/P&gt;&lt;P&gt;empno name&lt;/P&gt;&lt;P&gt;a sasi&lt;/P&gt;&lt;P&gt;b xxx &lt;/P&gt;&lt;P&gt;c yyy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table sal&lt;/P&gt;&lt;P&gt;empno salary&lt;/P&gt;&lt;P&gt;a 1000&lt;/P&gt;&lt;P&gt;b 2000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inner join&lt;/P&gt;&lt;P&gt;****************&lt;/P&gt;&lt;P&gt;select e&lt;SUB&gt;empno e&lt;/SUB&gt;name &lt;/P&gt;&lt;P&gt;s~sal &lt;/P&gt;&lt;P&gt;into table int_table&lt;/P&gt;&lt;P&gt;from emp as e&lt;/P&gt;&lt;P&gt;inner join sal as s&lt;/P&gt;&lt;P&gt;on &lt;/P&gt;&lt;P&gt;e&lt;SUB&gt;empno = s&lt;/SUB&gt;empno.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you made inner join between table a and b by emp no &lt;/P&gt;&lt;P&gt;the selection retrives only if the condition satisfy the output will be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a sasi 1000&lt;/P&gt;&lt;P&gt;b xxx 2000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Outer join&lt;/P&gt;&lt;P&gt;*************************&lt;/P&gt;&lt;P&gt;select e&lt;SUB&gt;empno e&lt;/SUB&gt;name &lt;/P&gt;&lt;P&gt;s~sal into table  int_table&lt;/P&gt;&lt;P&gt;from emp as e&lt;/P&gt;&lt;P&gt;LEFT OUTER JOIN sal as s&lt;/P&gt;&lt;P&gt;on &lt;/P&gt;&lt;P&gt;e&lt;SUB&gt;empno = s&lt;/SUB&gt;empno.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you made outer join (left /right ) the left table kept as it is the &lt;/P&gt;&lt;P&gt;if the condition satisfy the right table entries will fetch else leave it blank&lt;/P&gt;&lt;P&gt;the output will be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a sasi a 1000&lt;/P&gt;&lt;P&gt;b xxx b 2000&lt;/P&gt;&lt;P&gt;c yyy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2006 10:08:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/joins/m-p/1570578#M257593</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-09-13T10:08:22Z</dc:date>
    </item>
  </channel>
</rss>

