Oute Join and Inner Join

Hi,
I need to join three tables, based on some conditions (EKPO, EKBE and EKKN Note: All PO line items from EKPO will have a movement associated in the EKBE Table. Capture all PO line items where no matches found in the EKPO-EKBE join)
for the above requirement shall I write my query like this?
SELECT ekpo~ebeln
         ekpo~ebelp
         ekpo~loekz
         ekpo~txz01
         ekpo~matnr
         ekpo~bukrs
         ekpo~werks
         ekpo~menge
         ekpo~meins
         ekpo~knttp
         ekbe~vgabe
         ekbe~bwart
         ekbe~menge
         ekbe~dmbtr
         ekbe~shkzg
         ekkn~sakto
         ekkn~kostl
         ekkn~ps_psp_pnr
INTO CORRESPONDING FIELDS OF TABLE i_podata
         FROM ekpo LEFT OUTER JOIN ekbe ON ekbeebeln = ekpoebeln AND
                                           ekbeebelp = ekpoebelp
                        INNER JOIN ekkn ON ekknebeln = ekpoebeln AND
                                           ekknebelp = ekpoebelp
                                     WHERE ekpo~werks IN s_werks AND
                                           ekpo~ebeln IN s_ebeln.
Shall I use both Outer Join and Inner join in one Query?
Please correcte me.
Thanks
Frank Rex

Hi,
You can use both inner join and outer join in the same select statement.
Ensure first all the inner joins between tables are declared and put the left outer join at the end.
Some sample code for your reference:
  SELECT
          AVBELN AKUNNR ABSTNK ABSTDK AVKORG AVTWEG AAUART AKNUMV
          BPOSNR BMATNR BWERKS BSPART BLGORT BKZWI1
          SUM( BKWMENG ) AS KWMENG DBZIRK D~VKGRP
          EDISPO EPRCTR
FROM VBAK AS A INNER JOIN VBAP AS B ON AVBELN EQ BVBELN
               INNER JOIN VBPA AS C ON CVBELN EQ BVBELN
               INNER JOIN KNVV AS D ON DKUNNR EQ AKUNNR
            AND DVKORG EQ AVKORG AND DVTWEG EQ AVTWEG
               LEFT OUTER JOIN MARC AS E ON E~MATNR EQ
                         BMATNR AND EWERKS EQ B~WERKS
          INTO CORRESPONDING FIELDS OF TABLE IT_ORDERS
          WHERE A~VKORG IN SO_VKORG
          AND A~VTWEG IN SO_VTWEG
          AND A~KUNNR IN SO_KUNNR
          AND A~ERDAT IN SO_ERDAT
          AND A~AUART IN ('ZFOR','ZROR','ZEOR','ZDXR','ZXOR','ZRM1','ZGOR','ZSOR')
          AND B~MATNR IN SO_MATNR
          AND B~WERKS IN SO_WERKS
          AND B~SPART IN SO_SPART
          AND B~ABGRU EQ SPACE
          AND A~LIFSK EQ SPACE
          AND A~FAKSK EQ SPACE
          AND B~VSTEL IN SO_VSTEL
          AND B~LGORT IN SO_LGORT
          AND C~KUNNR IN SO_SHIP
          AND C~PARVW EQ 'WE'
          AND D~VKGRP IN SO_VKGRP
          AND D~BZIRK IN SO_BZIRK
          AND B~LGORT NE '0950'
          GROUP BY AVBELN AKUNNR ABSTNK ABSTDK 
          AVKORG AVTWEG AAUART AKNUMV B~POSNR
          BMATNR BWERKS BSPART BKZWI1 D~BZIRK
          DVKGRP BLGORT EDISPO EPRCTR E~MATGR.
Lakshminarayanan.
P.S.Mark all helpful answers for points.

Similar Messages

  • Performance considerations between a cross join and inner join

    Hi there,
    What's the performance difference and impact on running a cross-join based query against an inner join based query?
    Regards and thanks

    Before going to the performance issue - ensure you get the required data and not just some data shown.
    Performance should be checked only between equivalent queries which produce same output but with different processing.
    Are you sure you get same output in cross join as well as inner join?
    If so pass on your different queries and then discuss with one is better.

  • Nested loop, merge join and harsh join

    Can any one tell me the difference/relationship between nested loop, harsh join and merge join...Thanx

    Check Oracle Performance Tuning Guide
    13.6 Understanding Joins
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14211/optimops.htm#i51523

  • Difference between physical join and logical join

    Hi Gurus,
    Can anyone tell me what is the difference between physical join and logical join
    Thanks,
    Chandra

    Hi,
    A physical join is at the physical layer and defines the join between two physical tables. Logical joins live at the BMM (logical) layer and define a join between two logical tables.
    The important differentiation is that at the BMM layer you do not tell the OBIEE server how to do the join, you just tell it that there is a relationship between these two logical entities. When the server comes to this logical join it will use the information in the physical joins and decides how the two logical tables are joined together.
    In BMM you use complex joins to establish which logical tables are joined which another, the OBI EE server will go to the physical level to search the physical join to make the query. You can also use physical joins in the BMM to override the join in the physical layer but only in very specific conditions.
    If you also set complex join in the physical layer OBI EE won't be able to construct the physical query.
    Hope this answers your question.
    Award points if helpful.
    Thanks,
    -Amith.

  • Both equii join and natural join are equall.will both display same   output

    both equii join and natural join are equall.will both display same
    output?

    Hi ,
    What is preventing you to do a small test and check yourself?
    See the below link.
    http://psoug.org/reference/joins.html
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> CREATE TABLE parents (
      2  person_id  NUMBER(5),
      3  adult_name VARCHAR2(20),
      4  comments   VARCHAR2(40))
      5  PCTFREE 0;
    Table created.
    SQL>
    SQL> CREATE TABLE children (
      2  parent_id    NUMBER(5),
      3  person_id    NUMBER(5),
      4  child_name   VARCHAR2(20),
      5  comments     VARCHAR2(40))
      6  PCTFREE 0;
    Table created.
    SQL>
    SQL> INSERT INTO parents VALUES (1, 'Dan', 'So What');
    1 row created.
    SQL> INSERT INTO parents VALUES (2, 'Jack', 'Who Cares');
    1 row created.
    SQL> INSERT INTO children VALUES (1, 2, 'Anne', 'Who Cares');
    1 row created.
    SQL> INSERT INTO children VALUES (1, 1, 'Julia', 'Yeah Right');
    1 row created.
    SQL> INSERT INTO children VALUES (2, 1, 'Marcella', 'So What');
    1 row created.
    SQL> COMMIT;
    Commit complete.
    SQL>
    SQL> SELECT adult_name, child_name
      2  FROM parents NATURAL JOIN children;
    ADULT_NAME           CHILD_NAME
    Jack                 Anne
    Dan                  Marcella
    SQL> select adult_name,child_name from parents a, children b
      2  where a.person_id=b.person_id;
    ADULT_NAME           CHILD_NAME
    Jack                 Anne
    Dan                  Julia
    Dan                  Marcella
    SQL> ed
    Wrote file afiedt.buf
      1  select adult_name,child_name from parents a, children b
      2* where a.person_id=b.parent_id
    SQL> /
    ADULT_NAME           CHILD_NAME
    Dan                  Anne
    Dan                  Julia
    Jack                 Marcella
    SQL>Regards,
    Avinash

  • Diff bw complex join and physical join

    hi all
    Can sumbody explain me the all the differences between complex join and physical join in the admin tool
    Thanks
    Shobhit

    Hi,
    Suggest you to go through this link. It may be helpful in detail.
    http://st-urriculum.oracle.com/obe/fmw/bi/biee/r1013/bi_admin/biadmin.html
    Thanks,
    Vengatesh.

  • Link for BUT000 table and ADRC in CRM and inner join is not working in PCUI

    Hi Gurus,
       Please tell me the link btween BUT000 and ADRC table. and i wrote one inner join between BUT000 and BUT0id table but it not working. I m in CRM 4.0 version working with PCUI.
    select but000partner but000name_org1 but000name_org2 but000bus_sort1 but0id~parnter1
          but0ididnumber from but000 inner join but0id on but0idpartner = but000~parnter
    into corresponding fields of table it_result where partner in s_partner.
    It is giving error as partner unknown from but000 table. I delcared everything and tried with alias names also.
    please clarify me.
    regards,
    Ramakrishna.

    Hi Frederic,
       thanks a lot. But is inner join between BUT000 and BUT0ID will work. for me it is not working. plesae see this code.
    tables : but000,
             but0id,
             crmm_but_custno,
             adrc.
    types : begin of typ_but000,
            partner type bu_partner,
            name_org1 type BU_NAMEOR1,
            name_org2 type BU_NAMEOR2,
            bu_sort1  type BU_SORT1,
            idnumber type BU_ID_NUMBER,
            partner1 type bu_partner,
            end of typ_but000.
    data: lt_but000 type table of typ_but000,
          ls_but000 like line of lt_but000.
    *select-options : s_partnr for but000-partner.
    start-of-selection.
          select but000partner but000name_org1 but000name_org2 but000bu_sort1 but0id~parnter1
                    but0id~idnumber into corresponding fields of table lt_but000 from  but000
                    inner join but0id on but0idpartner = but000parnter. " where partner in s_partner.
    it is giving error as but000-partner is not know or but0id-partner not known.
    So, i think if it not works then i should write two select stmts.
    please clarify me.
    i gave u rating.
    thanks
    ramakrishna.

  • Diff between database view and inner join

    Hello,
    I need to select data from multiple tables. I need to choose between 2 options.
    1) create a database view and use this view for select.
    2) write an inner join in abap prorgam.
    In which cases we should create a view and in which cases we should use a inner join?
    What are the factors which decide these?
    Pls advice.
    Thanks,
    Rupali.

    Hi,
    Both are same..
    But if you use regulary and used view in Multiple programs then create view..
    If inner join in abap prorgam between two or more table used in less Programs and do not want to
    create View (Means not to create transport request) then go for JOin in Program.
    Prabhudas

  • What is the different between Logical complex join and Physical join?

    hi,
    Do somebody know what is the function different between logical complex join in BMM layer and physical join in physical layer?
    Thanks.

    Thank you very much1
    I understand their differentiation:
    In the BMM Complex join (intelligent), means OBI picks the best way from possibly many different ways to join using physical join. FK join forces the same join always, which limits flexibility.

  • Bind join and hash join

    Hi
    I would like to know if there is difference between bind join end hash join.
    For example If I write sql code in My query tool (in Data Federator Query server administrator XI 3.0) it is traduced in a hashjoin(....);If I set system parameters in right way to produce bind join, hashjoin(...) is present again!
    how do i understand the difference?
    bye

    Query to track the holder and waiter info
    People who reach this place for a similar problem can use the above link to find their answer
    Regards,
    Vishal

  • Difference between Innner Join and Cross Join

    Dear all,
    select * from tbl1 inner join tbl2 on tbl1.id =tbl2.id
    select * from tbl1 cross join tbl2 
    Works same what is the logical difference between this two statements??
    Dilip Patil..

    INNER Join returns the rows from  both tables which has satisfied matching condition.
    In
    CROSS Join, each record from tbl1 is matched with tbl2. Result would be Number Of rows in tbl1 X Number of rows in tbl2.
    Note: If you provide where condition in CROSS JOIN, it will give you same result as your first INNER JOIN query
    select * from tbl1 cross join tbl2 
    where tbl1.id =tbl2.id
    -Vaibhav Chaudhari

  • Equal Join and Outer Join in OBIEE

    Hello expert,
    I think the default join in OBIEE is Outer Join. So no matter what join conditions that I specify on the physical layer, the result that I get in the presentation layer is still outer join.
    How to specify the equal join or inner join in Business and Logical layer?

    Hello,
    Thank you for your reply. However it does not work. I got the following message:
    [nQSError: 32005] The object "Fact - Fruit" bc if type 'LOGICAL TABLE SOURCE': is missing a foreign key or a complex join in the join graph.
    The situation that I have is:
    Fact table: "Fact - Fruit"
    List of value table (look up table): "dim_list_of_values"
    I am only interested in the type in the "dim_list_of_values" table where equals to "Apple". So I only want to join the "Fact - Fruit" and "dim_list_of_values" with those records with "Apple" type.
    It sounds to me that I am unable to define a freign key.

  • Why is outer join more expensive than inner joins.

    Why is outer join more expensive than inner joins.
    Other than it may return more rows.
    If you know of any ORA docs on this, please let me know.
    Thanks.

    Outer join is inner join with outer union applied on top of it. As you correctly observed it returns more rows and that alone makes it more expensive. Secondly, outer join is not commutative. As a result some join permutations are exclused from consideration, which results in higher cost.

  • Outer join/inner join

    I have 4 related tables and want to join them all but can't
    figure out how to do it. Here are the columns that need to join:
    Table 1: EventID, PromoterID
    Table 2: EventID, LeagueID
    Table 3: LeagueID
    Table 4: PromoterID
    I want to join like this:
    Table2.EventID *= Table1.EventID and
    Table2.PromoterID = Table4.PromoterID and
    Table2.LeagueID = Table3.LeagueID
    But I can't do an outer and inner join on the same table.
    Events can have multiple leagues related to it. If I use
    inner joins for everything, it turns out okay until you search for
    an event by League - if that happens and the event has more than
    one related league, the search results will only show the league
    searched by and not all the other related leagues. If you search by
    other info like month or year, all leagues related to a particular
    event show up in the search results for each event. When I try to
    do an outer join on table 2 based on eventid, I then get stuck
    trying to join table 2 and table 3.
    This is probably a simple problem but my brain is feeling too
    fried to figure it out - can anyone help? Thanks!!

    You can also pull in the eventids based on leagues if your
    SQL engine supports subqueries.
    where
    Table2.EventID = Table1.EventID and
    Table2.PromoterID = Table4.PromoterID and
    Table2.LeagueID = Table3.LeagueID
    <cfif isdefined("form.leagueid")>
    <cfif trim(form.leagueid) neq ''>
    and table2.eventid in
    (select t2a.eventid from table2 t2a
    where t2a.eventid = table2.eventid
    and t2a.leagueid = '#form.leagueid#')
    </cfif>
    </cfif>
    <cfif isdefined("form.eventid")>
    <cfif trim(form.eventid) neq ''>
    and table2.eventid = '#form.eventid#'
    </cfif>
    </cfif>
    <cfif isdefined("form.promoterid")>
    <cfif trim(form.promoterid) neq ''>
    and table2.prompterid = '#form.promoterid#'
    </cfif>
    </cfif>
    ...

  • Syntax errors in update query with inner joins and sub query.

    Below is the query:
    UPDATE sp_CFQ_Coord_Corrections 
    INNER JOIN (CFQ_Coord_Corrections 
    INNER JOIN CFQ_Referrals ON CFQ_Coord_Corrections.CorrID = CFQ_Referrals.RecID) 
    ON sp_CFQ_Coord_Corrections.ID = CFQ_Referrals.RecID 
    SET CFQ_Coord_Corrections.MatchFound = 1, 
    CFQ_Coord_Corrections.RecTblID = [CFQ_Referrals].[RecTblID], 
    sp_CFQ_Coord_Corrections.MatchFound = 1
    WHERE (((CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((sp_CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((CFQ_Coord_Corrections.RecImported)=1) 
    AND ((CFQ_Referrals.RecFileName)='COORDCORR_SPOINT') 
    AND ((CFQ_Referrals.RecCombKey)='No.Match') 
    AND ((sp_CFQ_Coord_Corrections.RecImported)=1));
    Error messages seen when executed:
    Msg 156, Level 15, State 1, Line 3
    Incorrect syntax near the keyword 'INNER'.
    Msg 102, Level 15, State 1, Line 10
    Incorrect syntax near 'CFQ_Coord_Corrections'.
    Please help.....

    Below is the query:
    UPDATE sp_CFQ_Coord_Corrections 
    INNER JOIN (CFQ_Coord_Corrections 
    INNER JOIN CFQ_Referrals ON CFQ_Coord_Corrections.CorrID = CFQ_Referrals.RecID) 
    ON sp_CFQ_Coord_Corrections.ID = CFQ_Referrals.RecID 
    SET CFQ_Coord_Corrections.MatchFound = 1, 
    CFQ_Coord_Corrections.RecTblID = [CFQ_Referrals].[RecTblID], 
    sp_CFQ_Coord_Corrections.MatchFound = 1
    WHERE (((CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((sp_CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((CFQ_Coord_Corrections.RecImported)=1) 
    AND ((CFQ_Referrals.RecFileName)='COORDCORR_SPOINT') 
    AND ((CFQ_Referrals.RecCombKey)='No.Match') 
    AND ((sp_CFQ_Coord_Corrections.RecImported)=1));
    Error messages seen when executed:
    Msg 156, Level 15, State 1, Line 3
    Incorrect syntax near the keyword 'INNER'.
    Msg 102, Level 15, State 1, Line 10
    Incorrect syntax near 'CFQ_Coord_Corrections'.
    Please help.....
    sp_CFQ_Coord_Corrections is a table and not a stored procedure.
    are these both tables "sp_CFQ_Coord_Corrections" and "CFQ_Coord_Corrections" different ??

Maybe you are looking for

  • Help needed with binary data in xml (dtd,xml inside)

    I am using the java xml sql utility. I am trying to load some info into a table. my.dtd: <!ELEMENT ROWSET (ROW*)> <!ELEMENT ROW (ID,JPEGS?)> <!ELEMENT ID (#PCDATA)> <!ELEMENT DESCRIPTION EMPTY> <!ATTLIST DESCRIPTION file ENTITY #REQUIRED> <!NOTATION

  • Export song details to windows explorer

    I am trying to make the song details such as album name and artist show up in the media properties of the itunes media folder in windows explorer in windows 8.1. All the information shows in iTunes, and although I have consolidated the library and ti

  • String should select multiple tag's

    Dear All my issue is , This is a form tag enquiry form query whcih should retrieve multiple tag number's, but it is showing only one tag number for the below query. :tag_no      := x.tag_number; on this para meter is should select all the tag number'

  • Dbghelp.dll Error in Skype

    I get this error "Failed to load library" dbghelp.dll. This happend when I DD click on the Skype icon to display skype's open box for use I have check for the file error is still in windows, and it is. What is the solution for this, is this an unique

  • PC-Mac camera compatibility

    My boyfriend has a PC and I just got a new iBook G4...he has a webcam that works with MSN but won't work with my MSN because it is text only. What is a program that I could use to view his webcam? And then which webcam could I get later so that he wo