Relationship between tables while using inner joins.

Hi,
I had a few clarifications on "inner joins", and as i was going through the forum, i came across two points,
1. In one of the threads it said " inner joins is applicable for tables that have a parent child relationship.
2. In another thread it said " inner join is established from master table (the table on the left) to the transcation table (the table on the right)".
I have two clarifications based on the above points.
1. Is it necessary that the tables on which im performing an inner join should have a parent-child/children relationship or is it enough that the tables just have a common field.
2.  Also is it necessary that the master table should come first, (or can i use any child table from where i can fetch the records when there is a mater table in my report) as shown below.
Eg: select * <fields> from <master table> inner join <table> on <field> into <itab>.
Edited by: Narayananchandran on Dec 27, 2010 12:31 PM

have two clarifications based on the above points.
1. Is it necessary that the tables on which im performing an inner join should have a parent-child/children relationship or is it enough that the tables just have a common field.
2. Also is it necessary that the master table should come first, (or can i use any child table from where i can fetch the records when there is a mater table in my report) as shown below.
Eg: select * <fields> from <master table> inner join <table> on <field> into <itab>
1) NO
                  2) NO

Similar Messages

  • Select querry using inner join

    Hi Friends,
    I need to fetch data from two tables, I used inner join but I am not able to fetch the data in some fields can any one tell me what is wrong in this select querry.
    SELECT but000~partner
             but000~name_org1
             but000~name_first
             but000~name_last
             but000~bpext
          FROM but000 INNER JOIN dfkkop ON but000partner = dfkkopgpart
        INTO table lt_but000
        WHERE but000~partner IN so_part
        AND dfkkop~faedn IN so_faedn.
    Thanx in advance,
    Parvez

    hi Lutin,
    SELECT but000~partner
    but000~name_org1
    but000~name_first
    but000~name_last
    but000~bpext
    FROM but000 INNER JOIN dfkkop ON but000partner = dfkkopgpart  <------check this condition,it has to *satisfy  both table                                                                        
    INTO table lt_but000
    WHERE but000~partner IN so_part
    AND dfkkop~faedn IN so_faedn.
    Regards,
    siva
    Message was edited by:
            SivaKumar

  • How to use INNER JOIN in such case

    when i program as below[CASE1]. the code is able to active.
    CASE1:
    ==========================
    DATA: WK_BUKRS LIKE T001-BUKRS,
          WK_BUTXT LIKE T001-BUTXT,
          WK_TABLE(4) TYPE C VALUE 'T001'.
    START-OF-SELECTION.
      WK_BUKRS = 'DECN'.
      PERFORM GET_BUTXT USING WK_BUKRS WK_TABLE
                     CHANGING WK_BUTXT.
      WRITE: WK_BUTXT.
      FORM GET_BUTXT USING I_BUKRS LIKE T001-BUKRS
                           I_TABLE
                  CHANGING O_BUTXT LIKE T001-BUTXT.
        SELECT SINGLE BUTXT
                 INTO O_BUTXT
                 FROM (I_TABLE)
                WHERE BUKRS = I_BUKRS.
      ENDFORM.                   
    ===========================
    but when I need to INNER JOIN another table [CASE2]
    CASE2:
    =======================
    DATA: WK_BUKRS LIKE T001-BUKRS,
          WK_BUTXT LIKE T001-BUTXT,
          WK_TABLE(4) TYPE C VALUE 'T001'.
    START-OF-SELECTION.
      WK_BUKRS = 'DECN'.
      PERFORM GET_BUTXT USING WK_BUKRS WK_TABLE
                     CHANGING WK_BUTXT.
      WRITE: WK_BUTXT.
      FORM GET_BUTXT USING I_BUKRS LIKE T001-BUKRS
                           I_TABLE
                    CHANGING O_BUTXT LIKE T001-BUTXT.
        SELECT SINGLE BUTXT
                 INTO O_BUTXT
                 FROM (I_TABLE) AS G INNER JOIN BKPF AS H
                   ON GBUKRS = HBUKRS
                WHERE G~BUKRS = I_BUKRS.
      ENDFORM.          
    =================================
    Syntax error:
    Wrong expression "INNER" in FROM clause. WHERE condition.
    Can anybody help me to solve the problem.
    My requirement is to use INNER JOIN with variable table

    hi slam,
    chk this sample code.
    hi,
    table emp
    empno name
    a sasi
    b xxx
    c yyy
    table sal
    empno salary
    a 1000
    b 2000
    Inner join
    select eempno ename
    s~sal
    into table int_table
    from emp as e
    inner join sal as s
    on
    eempno = sempno.
    if you made inner join between table a and b by emp no
    the selection retrives only if the condition satisfy the output will be
    a sasi 1000
    b xxx 2000
    rgds
    anver
    if hlped mark points
    Message was edited by: Anversha s

  • TRACING RELATIONSHIP BETWEEN TABLES....

    Hello all,
    I use the below query to find the hierarchial relationship between tables ...
    SELECT
    c.table_name parent_table , c.column_name parent_column,b.table_name child_table ,b.column_name child_COLUMN ,LEVEL lrv
    FROM USER_constraints a,user_cons_columns b ,user_cons_columns c
    WHERE a.constraint_name = b.constraint_name
    AND a.r_constraint_name = c.constraint_name
    AND constraint_type = 'R'
    AND b.table_name <> 'CNTRCT_PARENT'
    START WITH b.table_name = 'CNTRCT_PARENT'
    CONNECT BY NOCYCLE PRIOR b.table_name = c.table_name
    ORDER BY c.table_name
    but i need order like below,
    parent table childtable1
    childtable1 grantchildtable1
    childtable1 grantchildtable2
    parent table childtable2
    childtable2 grantchildtable1
    childtable2 grantchildtable2
    childtable2 grantchildtable3
    how this sort of order by is possible ...
    Thanks in advance
    Vijay G

    Hi,
    Try
    ORDER SIBLINGS BY ...

  • Delete query using inner join

    I need to delete records from a table using inner join from other tables. See below for the table structure and records.
    CREATE TABLE STUDENT (ROLL_NO NUMBER(10),NAME VARCHAR2(100),DEPT_NO NUMBER(10),JOIN_DATE DATE);
    CREATE TABLE DEPART (DEPT_NO NUMBER(10), DEPT_NAME VARCHAR2(100));
    CREATE TABLE ACTIVE_DEPT (DEPT_NO NUMBER(10), IS_ACTIVE VARCHAR2(1));
    INSERT INTO STUDENT (ROLL_NO,NAME,DEPT_NO,JOIN_DATE) VALUES(1,'SAM',10,SYSDATE-10);
    INSERT INTO STUDENT (ROLL_NO,NAME,DEPT_NO,JOIN_DATE) VALUES(2,'ALEX',10,SYSDATE -10);
    INSERT INTO STUDENT (ROLL_NO,NAME,DEPT_NO,JOIN_DATE) VALUES(3,'FRANK',20,SYSDATE -10);
    INSERT INTO STUDENT (ROLL_NO,NAME,DEPT_NO,JOIN_DATE) VALUES(4,'WAYNE',20,SYSDATE+1);
    INSERT INTO STUDENT (ROLL_NO,NAME,DEPT_NO,JOIN_DATE) VALUES(5,'KRUL',30,SYSDATE -10);
    INSERT INTO STUDENT (ROLL_NO,NAME,DEPT_NO,JOIN_DATE) VALUES(6,'ALICE',40,SYSDATE -10);
    INSERT INTO DEPART (DEPT_NO,DEPT_NAME) VALUES (10,'DEPT1');
    INSERT INTO DEPART (DEPT_NO,DEPT_NAME) VALUES (20,'DEPT2');
    INSERT INTO DEPART (DEPT_NO,DEPT_NAME) VALUES (30,'DEPT3');
    INSERT INTO ACTIVE_DEPT (DEPT_NO,IS_ACTIVE) VALUES (10,'Y');
    INSERT INTO ACTIVE_DEPT (DEPT_NO,IS_ACTIVE) VALUES (20,'N');
    INSERT INTO ACTIVE_DEPT (DEPT_NO,IS_ACTIVE) VALUES (30,'Y');
    DELETE FROM STUDENT WHERE (STUDENT.DEPT_NO) IN (SELECT D.dept_no FROM DEPART D,ACTIVE_DEPT AD WHERE D.DEPT_NO = AD.DEPT_NO AND AD.IS_ACTIVE = 'N');The above delete query will delete two records from the STUDENT table. Now i want to include another condition say, join_date should be a past date (join_date < trunc(sysdate)).
    How to include this condition in the above delete statement. I know i can do this using a subquery but i wont prefer that option. Basically i don't have much idea about join in delete statements.
    Please help.

    Is this you need ?
    DELETE FROM student WHERE join_date < TRUNC(SYSDATE)
                                            AND student.dept_no IN (SELECT D.dept_no
                                                                      FROM depart d,active_dept ad
                                                                     WHERE d.dept_no = ad.dept_no AND ad.is_active = 'N');Only one record is deleted. -> 3,'FRANK',20,SYSDATE -10
    >
    Balaji      wrote:
    Yes. But here we are getting the dept_no from the sub query, is there a better way to achieve this without sub query?
    >
    As far I know you need to have sub query in this case.
    You can close this thread if answered. If you have any further queries please post it so that someone can help you.
    Edited by: Lokanath Giri on २० मार्च, २०१२ ५:०५ अपराह्न

  • How to create relationship between two records using MDM Java APIs

    Hi,
    I am trying to create relationship between two records using Java Apis. Please guide me in doing this.
    Regards,
    Niraj

    Hi Niraj,
    There is ModifyRelationshipsCommand:
    http://help.sap.com/javadocs/MDM/SP06/com/sap/mdm/data/commands/ModifyRelationshipsCommand.html
    Retrieve Relationship command:
    http://help.sap.com/javadocs/MDM/current/com/sap/mdm/schema/commands/GetRelationshipListCommand.html
    Also, please refer similar thread, MDM Java API and relationships.
    Hope it helps..
    Regards,
    Mandeep Saini

  • Relationship between tables in a module(urgent)

    Hi ,
    Am new to this domain(SAP)...
    I want to move datas to SAP through codes...
    For example,i want to add datas to ItemGroups module of Inventory module....But it failed...On the other hand,i was able to add datas to Item table of the same module...
    i think there is someother table to which ItemGroups is related..Could anyone kindly help me in finding out these type of relationship between tables in a moduel at ease?
    Hoping for your quick reply,
    Thanks

    hi
    I think in your scnario data is fetching from material valuation table based on material number (MBEW-MATNR), through document segment material table (MSEG-MATNR).
    Based on you company material management flow, your scenario is based.
    hope this helps
    thank you.

  • Query to find all relationships between tables

    Please help me wit the following
    Query to find all relationships between tables
    SAMPLE OUTPUT:
    PRIMTAB PRIMCOL FOREIGNTAB FOREIGN KEY
    DEPT DEPTNO EMP DEPTNO
    Return all records in the database.
    PLEASE HELP

    SET LINESIZE 150
    COLUMN primcol FORMAT A30
    COLUMN foreigncol FORMAT A30
    SELECT uc1.table_name AS primtab,
    ucc1.column_name AS primcol,
    uc2.table_name AS foreigntab,
    ucc2.column_name AS foreigncol
    FROM user_constraints uc1,
    user_constraints uc2,
    user_cons_columns ucc1,
    user_cons_columns ucc2
    WHERE uc1.constraint_name = uc2.r_constraint_name
    AND uc1.constraint_name = ucc1.constraint_name
    AND uc2.constraint_name = ucc2.constraint_name
    AND ucc1.position = ucc2.position
    ORDER BY uc1.table_name,
    ucc1.position
    /

  • How to use Inner join of table as Source in Merge statement in SQL

    Hi All,
        I am trying to make source as multiple tables output using Join while coding there is no any syntax error but when i am executing this statement is giving following error
    Following is the query 
    Merge Into EmpDept Target
    Using (select E.Address,e.Design,e.EmailId,e.EmpId,e.Ename,e.ManagerId, e.Salary,D.DeptId,D.DeptName,D.Location from Employee E Inner join Dept D on E.DeptId=D.DeptId )As Source (Address,Design,EmailId,EmpId,EName,ManagerId,Salary,DeptId,DeptName,Location)
    On Source.EmpId=Target.EmpId
    when not matched then
    Insert (Target.Address,Target.Design,Target.EmailId,Target.EmpId,Target.Ename,Target.ManagerId, Target.Salary,Target.DeptId,Target.DeptName,Target.Location)
    values
    (Address,Design,EmailId,EmpId,EName,ManagerId, Salary,DeptId,DeptName,Location)
    When matched then 
    Update set Target.Address = Source.Address ,Target.Design = Source.Design,Target.EmailId      = Source.EmailId     ,Target.Ename       = Source.Ename      ,Target.ManagerId = Source.ManagerId , Target.Salary        = Source.Salary       ,Target.DeptId      = Source.DeptId      ,Target.DeptName = Source.DeptName ,Target.Location    = Source.Location;
    This is error while executing the above merge statement 
    The insert column list used in the MERGE statement cannot contain multi-part identifiers. Use single part identifiers instead.
    Please suggest me where i am wrong.. 
    Niraj Sevalkar

    MERGE INTO EmpDept Target
    Using (SELECT E.Address,
    e.Design,
    e.EmailId,
    e.EmpId,
    e.Ename,
    e.ManagerId,
    e.Salary,
    D.DeptId,
    D.DeptName,
    D.Location
    FROM Employee E
    INNER JOIN Dept D
    ON E.DeptId = D.DeptId) AS Source (Address, Design, EmailId, EmpId, EName, ManagerId, Salary, DeptId, DeptName, Location)
    ON Source.EmpId = Target.EmpId
    WHEN NOT matched THEN
    INSERT (Address,
    Design,
    EmailId,
    EmpId,
    Ename,
    ManagerId,
    Salary,
    DeptId,
    DeptName,
    Location)
    VALUES (Address,
    Design,
    EmailId,
    EmpId,
    EName,
    ManagerId,
    Salary,
    DeptId,
    DeptName,
    Location)
    WHEN matched THEN
    UPDATE SET Address = Source.Address,
    Design = Source.Design,
    EmailId = Source.EmailId,
    Ename = Source.Ename,
    ManagerId = Source.ManagerId,
    Salary = Source.Salary,
    DeptId = Source.DeptId,
    DeptName = Source.DeptName,
    Location = Source.Location;

  • Join on 3 tables using inner join.

    Hi friends can one one correct the below code and send me back.
    its showing some error.
    SELECT a~matnr
               a~werks
               b~maktx
               c~prctr
               c~bklas
               C~stprs
               c~peinh
              INTO TABLE it_detail
              FOR ALL ENTRIES IN itab
              FROM marc AS a INNER JOIN makt AS b
              ON amatnr = bmatnr
              inner join mbew AS c
              WHERE a~matnr = itab-matnr
              and     werks = itab-werks.

    Hi,
    Pls find the below piece of code.
         begin of it_detail occurs 0,
               matnr like mara-matnr,
               werks like marc-werks,
               prctr like marc-prctr,          
               maktx like makt-maktx,
               bklas like mbew-bklas,
               stprs like mbew-stprs,
               peinh like mbew-peinh,
         end   of it_detail.
    SELECT a~matnr
    a~werks
    a~prctr
    b~maktx
    c~bklas
    C~stprs
    c~peinh
    INTO TABLE it_detail
    FROM marc AS a INNER JOIN makt AS b
    ON amatnr = bmatnr
    inner join mbew AS c
    on amatnr = cmatnr
    FOR ALL ENTRIES IN itab
    WHERE a~matnr = itab-matnr
    and   a~werks = itab-werks.
    if it is not working, pls send me the error message that you are getting.
    Thanks,
    Sreeram.
    Edited by: Sreeram Prasad on Aug 19, 2008 5:07 PM
    Edited by: Sreeram Prasad on Aug 19, 2008 5:12 PM

  • How to use Inner Join for these 4 table's

    Hi Guys,
                  My Requirement is i have to get the data into the final Internal table whose structure is like this (BWKEY   type  MBEW-BWKEY,
            MATNR   type  MBEW-MATNR,
            MAKTX   type  MAKT-MAKTX,
            BWTTY   type  MBEW-BWTTY,
            BWTAR   type  MBEW-BWTAR,
            MEINS   type  MARA-MEINS,
            BKLAS   type  MBEW-BKLAS,
            VPRSV   type  MBEW-VPRSV,
            STPRS   type  MBEW-STPRS,
            PEINH   type  MBEW-PEINH,
            CRCY(3)    type  c,
            LBKUM   type  MBEW-LBKUM,
            SALK3   type  MBEW-SALK3,
            LAEPR   type  MBEW-LAEPR,
            J_3ADEFSI   type  MARC-J_3ADEFSI,
            J_4kDEFSC   type  MARC-J_4kDEFSC,
            SCLAS   type  MARA-/AFS/SCLAS,
            EKALR   type  MBEW-EKALR,
            HKMAT   type  MBEW-HKMAT,
            HRKFT   type  MBEW-HRKFT,
            KOSGR   type  MBEW-KOSGR,
            PRCTR   type  MARC-PRCTR,
            MMSTA   type  MARC-MMSTA,
            SOBSK   type  MARC-SOBSK,
            PPRDL   type  MBEW-PPRDL,
            LPLPR   type  MBEW-LPLPR,
            PPRDZ   type  MBEW-PPRDZ,
            ZPLPR   type  MBEW-ZPLPR)
                  from 4 table's MBEW , MARA MAKT and MARC.
         Can anybody provide the logci for this based on the below requirement
    "Go to table MBEW with material number, plant and valuation type; fetch the information laid out in output format. There are some fields which need to come from tables MARC, MARA and MAKT. The common criterion is material number across these tables.
    MBEW-MATNR = MARC-MATNR
    MBEW-MATNR = MARA-MATNR
    MBEW-MATNR = MAKT-MATNR
    Thanks,
    Gopi.

    Hello Gopi,
    I did not have system now and just written in notepad..
    types : begin of ty_mbew ,
    MATNR type MBEW-MATNR,
    BWTTY type MBEW-BWTTY,
    BWTAR type MBEW-BWTAR,
    MEINS type MARA-MEINS,
    BKLAS type MBEW-BKLAS,
    VPRSV type MBEW-VPRSV,
    STPRS type MBEW-STPRS,
    PEINH type MBEW-PEINH,
    CRCY(3) type c, " What is this field ,i did not include in join
    LBKUM type MBEW-LBKUM,
    SALK3 type MBEW-SALK3,
    LAEPR type MBEW-LAEPR,
    J_3ADEFSI type MARC-J_3ADEFSI,
    J_4kDEFSC type MARC-J_4kDEFSC,
    SCLAS type MARA-/AFS/SCLAS,
    EKALR type MBEW-EKALR,
    HKMAT type MBEW-HKMAT,
    HRKFT type MBEW-HRKFT,
    KOSGR type MBEW-KOSGR,
    PRCTR type MARC-PRCTR,
    MMSTA type MARC-MMSTA,
    SOBSK type MARC-SOBSK,
    PPRDL type MBEW-PPRDL,
    LPLPR type MBEW-LPLPR,
    PPRDZ type MBEW-PPRDZ,
    ZPLPR type MBEW-ZPLPR,
    end of ty_mbew.
    types : begin of ty_makt ,
    matnr type makt-maktx,
    MAKTX type MAKT-MAKTX,
    end of ty_makt.
    types : begin of ty_final ,
    MATNR type MBEW-MATNR,
    MAKTX type MAKT-MAKTX,
    BWTTY type MBEW-BWTTY,
    BWTAR type MBEW-BWTAR,
    MEINS type MARA-MEINS,
    BKLAS type MBEW-BKLAS,
    VPRSV type MBEW-VPRSV,
    STPRS type MBEW-STPRS,
    PEINH type MBEW-PEINH,
    CRCY(3) type c,
    LBKUM type MBEW-LBKUM,
    SALK3 type MBEW-SALK3,
    LAEPR type MBEW-LAEPR,
    J_3ADEFSI type MARC-J_3ADEFSI,
    J_4kDEFSC type MARC-J_4kDEFSC,
    SCLAS type MARA-/AFS/SCLAS,
    EKALR type MBEW-EKALR,
    HKMAT type MBEW-HKMAT,
    HRKFT type MBEW-HRKFT,
    KOSGR type MBEW-KOSGR,
    PRCTR type MARC-PRCTR,
    MMSTA type MARC-MMSTA,
    SOBSK type MARC-SOBSK,
    PPRDL type MBEW-PPRDL,
    LPLPR type MBEW-LPLPR,
    PPRDZ type MBEW-PPRDZ,
    ZPLPR type MBEW-ZPLPR,
    end of ty_final.
    Internal tables
    data :i_mbew type standard table of ty_mbew,
    i_makt type standard table of ty_makt,
    i_final type standard table of ty_final.
    Work Areas
    data : wa_mbew like line of i_mbew,
    wa_makt like line of i_makt,
    wa_final like line of i_final.
    start-of-selection.
    get the data from MBEW,MARA,MARC Table
    select aMATNR aBWTTY
           aBWTAR bMEINS
           aBKLAS aVPRSV
           aSTPRS aPEINH
    *CRCY(3) type c,
    aLBKUM aSALK3 a~LAEPR
    c~J_3ADEFSI type MARC-J_3ADEFSI,
    c~J_4kDEFSC type MARC-J_4kDEFSC,
    b~SCLAS type MARA-/AFS/SCLAS,
    aEKALR aHKMAT
    aHRKFT aKOSGR
    cPRCTR cMMSTA
    cSOBSK aPPRDL
    aLPLPR aPPRDZ
    a~ZPLPR into corresponding fields of table i_mbew
            from mbew as a inner join mara as b on bmatnr = amatnr
            inner join marc as c on cmatnr = amatnr.
    if sy-subrc eq 0.
    select matnr maktx from makt into table i_makt
                 for all entries in i_mbew
                 where matnr = i_mbew-matnr
                 and   spras = sy-langu.
    endif.
    loop at i_mbew into wa_mbew.
    read the data from MAKT Table
    read table i_makt into wa_makt with key matnr = wa_mbew-matnr.
    if sy-subrc eq 0.
    move-corresponding wa_mbew to wa_final.
    move wa_makt-maktx to wa_final-maktx.
    append wa_final to i_final.
    endif.
    endloop.
    Thanks
    Seshu

  • How to use inner joins for 4 0r 5 tables

    Hai Experts,
    plz check my code, n plz help to inner join all the tables
    TYPES : BEGIN OF ITAB,
           EBELN TYPE EKKO-EBELN,            "P.O.NUMBER
           AEDAT TYPE EKKO-AEDAT,            "DATE
           BPRME TYPE EKPO-BPRME,            "UNIT PRICE
           MENGE TYPE EKPO-MENGE,            "Purchase order quantity
           WERKS TYPE EKPO-WERKS,            "PLANT
           BRTWR TYPE EKPO-BRTWR,            "Gross order value in PO
           STRAS TYPE LFA1-STRAS,            "House number and street
           LIFNR TYPE LFA1-LIFNR,            "VENDOR NO
           NAME1 TYPE LFA1-NAME1,            "V NAME
           ORT01 TYPE LFA1-ORT01,            "CITY
           LAND1 TYPE LFA1-LAND1,            "LAND
           PSTLZ TYPE LFA1-PSTLZ,             "POSTAL CODE
           MAKTX TYPE MAKT-MAKTX,            "DESCRIPTION
    END OF ITAB.
    <b>and i got stucked here:</b>
    <u></u>
    SELECT EKKO~EBELN
             EKKO~AEDAT
             EKPO~BPRME
             EKPO~MENGE
             EKPO~WERKS
             EKPO~BRTWR
             LFA1~LIFNR
             LFA1~STRAS
             LFA1~NAME1
             LFA1~ORT01
             LFA1~LAND1
             LFA1~PSTLZ
             MAKT~MAKTX
             INTO TABLE ITAB
             FROM EKKO
             INNER JOIN EKPO LFA1 T001W MAKT
             ON EKKOEBELN = EKPOEBELN
                EKKO~EBELN
             WHERE EKKO~EBELN IN S_EBELN.

    hi Rajesh,
    you have to join the tables one by one:
    SELECT ekko~ebeln
                 ekko~aedat
                 ekpo~bprme
                 ekpo~menge
                 ekpo~werks
                 ekpo~brtwr
                 lfa1~lifnr
                 lfa1~stras
                 lfa1~name1
                 lfa1~ort01
                 lfa1~land1
                 lfa1~pstlz
                 makt~maktx
    INTO TABLE itab
    FROM ekko AS ekko
    INNER JOIN ekpo AS ekpo
    ON ekkoebeln EQ ekpoebeln
    INNER JOIN lfa1 AS lfa1
    ON ekkolifnr EQ lfa1lifnr
    INNER JOIN t001w AS t001w
    ON ekpowerks EQ t001wwerks
    INNER JOIN makt AS makt
    ON ekpomatnr EQ MAKTmatnr
    WHERE ekko~ebeln IN s_ebeln.
    This is the complete SELECT. BUT! The performance will be much better if you take out T001W and MAKT from the INNER JOIN. Do select on these tables in separate steps and merge the internal tables afterwards.
    hope this helps
    ec

  • 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

  • ONE-to-MANY relationship between tables and forms in APEX

    I recently started using APEX and I have run into an issue.
    I have a ONE-TO-MANY relationship between two tables, A1 and A2, respectively.
    A1:
    A1_ID
    Item
    A2:
    A2_ID
    SubItem
    A1_ID
    I have 2 forms (lets call it F1 and F2) that I use to capture data for A1 and A2.
    On F2, I have the following fields that are setup to capture data:
         A2.A1_ID
    **A1.Item (this is a drop down that is populated using a SELECT statement where the select uses A1.Item field)
         A2.SubItem (user would enter SubItem)
    Note: A2.A2_ID is populated using a SEQ
    Everytime I pick **A1.Item on F2, is there a way to link to A1 table and display A1.A1_ID for every **A1.Item selected on F2?
    If so, I want to store the value captured in F2 for the A1_ID field into A2 table to maintain my 1-to-MANY relationship.
    If this will work, how do I go about implementing this solution?
    Can someone help me?

    I think it sounds like you are asking for a Master-Detail form. Try that and see what you get.
    chris.

  • Why can't i use "INNER JOIN" in a query for SQL Server with JDBC??????

    Hi,
    I'm trying to execute some SQL queries and I just don't understand what's wrong.
    I�m using Tomcat and SQL Server in order to do this, but when I�m try to execute a query with a INNER JOIN statements Tomcat raise a SQL exception... at the very first time I thought there was a problem with database connection but I realize that a simple query to a table works pretty well. then I found out some problems with JDBC:ODBC.... so I install JDBC for SQL Server 2000 and test with the same simple query and works..... so, I come to a conclusion.... INNER JOIN or JOIN statements can't be used in JDBC..... please... somebody tell I�m wrong and give me a hand...
    I'm using TOMCAT 4 and JDK 1.4 SQL Server 2000
    Error occurs when executeQuery() is called.... not prepareStatement().... ??????
    Driver DriverRecResult = (Driver)Class.forName(driver).newInstance();
    Connection ConnRecResult = DriverManager.getConnection(DSN,user,password);
    PreparedStatement StatementRecResult = ConnRecResult.prepareStatement(query);
    ResultSet RecResult = StatementRecResult.executeQuery(); <---- Exception raise here
    So much tahnks in advance,

    That's exactly what I think, driver it's raising the exception, but I don't know why.... i test the same query with INNER JOIN directly from SQL Query Analyser and it's works perfectly, my problem ain't SQL, but JSP and JDBC 'cause i'm a newbie about these issues.
    Common sense tell me possible problems lie in SQLServer drivers 'cause i run the same pages on JRUN through jdbc:odbc and do works well, but by now i just depend on Tomcat.....
    I've installed SQL Server drivers for JDBC but i just find it doesn't work fully... could be the version of JDK i've installed? what version do i need?
    ( I'm running Tomcat 4 with JDK 1.4 & SQL Server 2000 W2K )
    thanks for reply.

Maybe you are looking for