Select or inner join

hi all,
i have to extract data from 3 different tables.
is a single inner join better option or separate select statements ?
thanks

Hi,
If there are common key fields in the three tables, then inner join is a better option else its better to use for all entries to fetch the data.
If you want an example to join 3 tables, you can find it at this path in SAP
ABAPDOCU(Transaction)>ABAP Database Access>Open SQL>Read data>Inner Join.
you can find the following code*
DATA: BEGIN OF wa,
        carrid TYPE spfli-carrid,
        connid TYPE spfli-connid,
        fldate TYPE sflight-fldate,
        bookid TYPE sbook-bookid,
      END OF wa,
      itab LIKE SORTED TABLE OF wa
                WITH UNIQUE KEY carrid connid fldate bookid.
SELECT  pcarrid pconnid ffldate bbookid
  INTO  CORRESPONDING FIELDS OF TABLE itab
  FROM  ( ( spfli AS p
            INNER JOIN sflight AS f ON pcarrid = fcarrid AND
                                       pconnid = fconnid    )
            INNER JOIN sbook   AS b ON bcarrid = fcarrid AND
                                       bconnid = fconnid AND
                                       bfldate = ffldate     )
  WHERE p~cityfrom = 'FRANKFURT' AND
        p~cityto   = 'NEW YORK'  AND
        fseatsmax > fseatsocc.
LOOP AT itab INTO wa.
  AT NEW fldate.
    WRITE: / wa-carrid, wa-connid, wa-fldate.
  ENDAT.
  WRITE / wa-bookid.
ENDLOOP.
Reward if helpfull
Regards,
Adithya M

Similar Messages

  • ORA-00947 Error on straight SELECT with INNER JOINs

    I have a REAL bizarre situation. I have a SQL SELECT Statement that is joining a few tables. I actually have a WHERE clause where I am filtering by a coulmn within one of the joins. However, if I try to SELECT that coulmn, I am getting an Oracle error ORA-00947. I can even SELECT * and get ALL the columns back form ALL the tables I'm joing on, including the one that is not allowing me just to select it.
    Has anyone ever seen anything like this before???
    I appreciate your review and am hopeful for a reply.
    Thanks.
    PSULionRP

    Jez....Not sure if I need to worry about proprietary stuff here...Here's the SQL and the column I'm trying to select is CDM_SUPPLIER_UTILITY.SUPPLIER_CD.
    When I do that is when I get the ORA-00947 error. And our version is...
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    SELECT CDM_CALENDAR.CALENDAR_DT,
    CDM_OFFER.SUPPLIER_NAME,
    CDM_SUPPLIER_UTILITY.SUPPLIER_CD,
    ABS(SUM(CDM_MONEY.TRANSACTION_AMT))
    FROM CDEDM.CDM_TRANSACTIONS CDM_TRANSACTIONS
    INNER JOIN CDEDM.CDM_MONEY CDM_MONEY
    ON CDM_MONEY.TRANSACTION_FK = CDM_TRANSACTIONS.TRANSACTION_GK_PK
    INNER JOIN CDEDM.CDM_OFFER CDM_OFFER
    ON CDM_OFFER.OFFER_GK_PK = CDM_MONEY.OFFER_FK
    INNER JOIN CDEDM.CDM_CALENDAR CDM_CALENDAR
    ON CDM_CALENDAR.CALENDAR_DT_PK = CDM_MONEY.TRANSACTION_DT_FK
    INNER JOIN CDEDM.CDM_BILL_ACCOUNTS CDM_BILL_ACCOUNTS
    ON CDM_BILL_ACCOUNTS.BILL_ACCT_GK_PK = CDM_MONEY.BILL_ACCOUNTS_FK
    INNER JOIN CDEDM.CDM_SUPPLIER_UTILITY CDM_SUPPLIER_UTILITY
    ON CDM_SUPPLIER_UTILITY.SUPPLIER_UTILITY_GK_PK = CDM_BILL_ACCOUNTS.SUPPLIER_FK
    WHERE CDM_SUPPLIER_UTILITY.SUPPLIER_CD = 'MC2'
    AND CDM_CALENDAR.CALENDAR_DT BETWEEN NEXT_DAY(trunc(SYSDATE-12),'Saturday')
    AND NEXT_DAY(trunc(SYSDATE-5),'Saturday')
    AND CDM_TRANSACTIONS.TRAN_DECODE IN
    'Debit/Bill Installment Billing',
    'Debit/Bill Electric Service',
    'Debit by Transfer of Payment TO Uncollec',
    'Debit Miscellaneous Electric',
    'Credit for Transfer TO Uncollectible',
    'Credit for Tranfer FROM Uncollectible',
    'Credit Miscellaneous Electric',
    'Credit Alteration',
    'Credit Allowance',
    'Bill Consumption On An Inactive Meter'
    AND CDM_MONEY.TRANSACTION_LEVEL_CD IN
    'A',
    GROUP BY CDM_CALENDAR.CALENDAR_DT,
    CDM_OFFER.SUPPLIER_NAME,
    CDM_SUPPLIER_UTILITY.SUPPLIER_CD

  • Select with inner join

    hi friends,
    can we use where clause in select statement with inner join.
    i am using following code which gives error (The column name "WERKS" has two meanings . .).
      SELECT AMATNR ACHARG AERSDA BMENGE B~MEINS
          FROM MCHA AS A INNER JOIN CHVW AS B
          ON ACHARG = BCHARG
          INTO TABLE T_OUTPUT1
          WHERE WERKS = PLANT AND CHARG = P_CHARG.
    thanks.

    Yes u can  use where clause in select statement with inner join.
    SELECT AMATNR ACHARG AERSDA BMENGE B~MEINS
    FROM MCHA AS A INNER JOIN CHVW AS B
    ON ACHARG = BCHARG
    INTO TABLE T_OUTPUT1
    WHERE WERKS = PLANT AND CHARG = P_CHARG.
    " mention  the table name in where condition also like awerks or bwerks.
    egards
    Rajendra

  • To Optimise SELECT- 9 INNER joins

    iam using 9 database tables in my final itab  and i want  final-itab  data  to  retrieved  from 9 database tables satisfying the conditions  of the user given data for  1st  table  later for  2nd 3rd 4th and  upto  9 th   database  tables  data to be  retrieved from 1st to 2nd  and for   3 rd  it should  be taken from  2nd..
    so i have declared  one finalitab and  iam putting  9 inner joins ..  so  as  data  in my  server is less so its getting  but  how to improve  my  SELECT query  such that i can get  faster unless the size of the data onthe server..
    so  please  give me solution for the query...
    Thanks in advance..

    please  check .. this  is my  Select  Query . and i dont want to have  9 itabs  as iam  working  it  for  SMARTFORMS...
    so i want all the data to  be  into one finalitab... so  please give me.. good  solution.. for the innerjoins.such that i can do it  more.. ...
    SELECT A~TKNUM
           A~VBELN
           A1~TDLNR
           A1~TNDR_LTPD
           A2~DISTZ
           B~WERKS
           C~VSTEL
           D~BWKEY
           D~BUKRS
           E~BUTXT
           F~KUNNR
          G~NAMEV
          G~NAME1
          G~TELF1
          H~ADRNR
          I~ADDRNUMBER
          I~NAME1
          I~CITY1
                         INTO  CORRESPONDING FIELDS OF TABLE IT_HEADER
                         FROM  VTTP  AS A  INNER JOIN  LIPS  AS B  ON AVBELN = BVBELN
                         INNER JOIN VTTK AS A1  ON A1TKNUM = ATKNUM
                         INNER JOIN VTTS AS A2  ON A2TKNUM = ATKNUM
                         INNER JOIN T001K AS D  ON BWERKS = DBWKEY
                         INNER JOIN T001 AS  E  ON DBUKRS = EBUKRS
                         INNER JOIN T001W AS F ON  DBWKEY = FWERKS
                        INNER JOIN KNVK AS G  ON FKUNNR = GKUNNR
                         INNER JOIN LIKP AS C ON  BVBELN = CVBELN
                         INNER JOIN TVST AS H ON CVSTEL = HVSTEL
                         INNER JOIN ADRC AS I ON HADRNR = IADDRNUMBER
                        WHERE   A~TKNUM = P_SHIPNO.
    where Tknum  is the Shipment  number.... taken from user  as  parameter.....
    thnaks  in advance..

  • Select - SUM - inner join

    Hi,
        select sum( a~dmbtr )
              into o_debit
              from bsik as A inner join FAGLFLEXA as B
                on abukrs = bRBUKRS
               and agjahr = bRYEAR
               and abelnr = bdocnr
             where a~bukrs = x_bukrs
               and a~lifnr = p_lifnr
               and a~shkzg = 'S'
               and a~budat in s_budat
               and a~hkont gt '0000000000'
               and a~hkont le '9999999999'
               and b~prctr = p_prctr.
    Above query is not giving result in o_debit though data is available in both the table. Please guide me, if I have written something wrong.

    Hi, Raj.
    Test the following Sample It is working fine for me hope will work for you too, I did some little change.
    TYPES: BEGIN OF ty_test,
      dmbtr LIKE bsik-dmbtr,
      END OF ty_test.
    DATA: it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE.
    SELECT SUM( a~dmbtr ) as dmbtr
    INTO CORRESPONDING FIELDS OF TABLE it_test
    FROM bsik AS a INNER JOIN faglflexa AS b ON ( a~bukrs = b~rbukrs AND a~gjahr = b~ryear AND a~belnr = b~docnr )
    WHERE a~bukrs = x_bukrs
    AND a~lifnr = p_lifnr
    AND a~shkzg = 'S'
    AND a~budat IN s_budat
    AND a~hkont GT '0000000000'
    AND a~hkont LE '9999999999'
    AND b~prctr = p_prctr.
    Please Reply if still any Issue,
    Best Regards,
    Faisal

  • Need help SELECT wiht  INNER JOIN

    Hi,
    I need the the entire record of the MVKE with the same vkorg as in the table YMMARKET. Why has the bellow Join syntex error. Thank you
      SELECT *
        FROM MVKE
        INNER JOIN YMMARKET_CODE ON mvkevkorg = ymmarket_codevkorg
        WHERE matnr = p_matnr.
      ENDSELECT.

    Hello,
    Do this:
    DATA:
      lt_mvke TYPE STANDARD TABLE OF MVKE.
    SELECT <field1> <field2>
    INTO TABLE lt_mvke
    FROM MVKE AS M INNER JOIN YMMARKET_CODE AS Y ON m~vkorg = y~vkorg
    WHERE matnr = p_matnr.
    When using inner join you need to specify the fields.
    I suggest you the following:
    SELECT * FROM MVKE INTO TABLE lt_mvke
      FOR ALL ENTRIES IN YMMARKET_CODE
      WHERE matnr = p_matnr
           AND vkorg = ymmarket_code-vkorg.
    Regards,

  • Performance tuning of select with inner join

    Hi experts,
    I need to improve the performanve in these two big selects, could you give me some tips, please?Thanks!
      SELECT AWBELN BPOSNR ARFBSK AWFDAT ALIFRE AKNUMV
             BZZ_TKNUM BKOWRR BZZ_VSART BZZ_DTABF
             CTKNUM CVSART C~TDLNR
             CDTABF CSHTYP C~SDABW
             DTPNUM DVBELN
             EERDAT EVSTEL EKUNNR EANZPK EBTGEW EGEWEI
             E~LFDAT
         INTO CORRESPONDING FIELDS OF TABLE GT_AGENCY
            FROM WBRK AS A
              INNER JOIN WBRP AS B
                 ON AWBELN = BWBELN AND
                    B~KOWRR EQ ''
              INNER JOIN VTTK AS C
                 ON BZZ_TKNUM = CTKNUM
              INNER JOIN VTTP AS D
                 ON CTKNUM = DTKNUM
              INNER JOIN LIKP AS E
                 ON DVBELN = EVBELN
              WHERE A~WBELN IN SO_WBELN AND
                    A~RFBSK IN SO_RFBSK AND
                    A~WFDAT IN SO_WFDAT AND
                    A~LIFRE IN SO_TDLNR AND
                    B~ZZ_VSART IN SO_VSART AND
                    B~ZZ_DTABF IN SO_DTABF AND
                    C~VSART IN SO_VSART AND
                    D~TKNUM IN SO_REBEL AND
                    D~VBELN IN SO_VBELN AND
                    E~ERDAT IN SO_ERDAT AND
                    E~VSTEL IN SO_VSTEL AND
                    E~KUNNR IN SO_KUNNR.
      SORT GT_AGENCY BY TDLNR VSTEL TKNUM TPNUM VBELN.
      DELETE ADJACENT DUPLICATES FROM GT_AGENCY
      COMPARING TDLNR VSTEL TKNUM TPNUM VBELN.
      IF NOT GT_AGENCY[] IS INITIAL.
        SELECT VFKPTDLNR VFKPFKNUM VFKPFKPOS VFKPKNUMV          VFSIKPOSN VFKPREBEL VFSIVBELN vfsivbtyp
          INTO corresponding fields of TABLE GT_SHIPCOST
          FROM VFKP
          JOIN VFSI ON VFSIKNUMV = VFKPKNUMV
          WHERE VFKP~TDLNR IN SO_TDLNR
             AND VFKP~FKNUM IN SO_FKNUM
             AND VFKP~FKPOS IN SO_FKPOS
             AND VFKP~STBER IN SO_STBER
           AND VFKP~FKPTY IN SO_FKPTY
           AND ( VFSI~VBTYP = 'J'(S01) OR
                 VFSI~VBTYP = 'T'(S03) or
                 vfsi~vbtyp = 'a' ).
      ENDIF.
    Thanks a lot!
    Patricia

    Hi
    1) Dont use nested seelct statement
    2) If possible use for all entries in addition
    3) In the where addition make sure you give all the primary key
    4) Use Index for the selection criteria.
    5) You can also use inner joins
    6) You can try to put the data from the first select statement into an Itab and then in order to select the data from the second table use for all entries in.
    7) Use the runtime analysis SE30 and SQL Trace (ST05) to identify the performance and also to identify where the load is heavy, so that you can change the code accordingly
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5d0db4c9-0e01-0010-b68f-9b1408d5f234
    1. Use Inner Joins
    2. INTO TABLE
    3. No nested loop
    4. FOR ALL ENTRIES
    5. Use as much of the key as possible
    5. try to use primary or secondary keys in where condition. When using key fields, start with first key field.
    6. Select only the fields you need for display/processing - avoid select *
    Reward if useful
    regards
    Anji

  • Select query----- inner join codition

    i have used below query to get fields from ekpo and eket tables.
    i am getting error as the column name 'ebeln' has two meanings.
    SELECT A~EBELN
           A~EBELP
           A~TXZ01
           A~MENGE
           A~MEINS
           A~NETPR
           A~NETWR
           B~EINDT
    FROM EKPO AS A INNER JOIN EKET AS B
                          ON AEBELN = BEBELN
                          AND AEBELP = BEBELP
    INTO CORRESPONDING FIELDS OF TABLE IT_ITEM
    WHERE EBELN = I_EBELN.
    please tell what could be the problem
    regards,
    krishna

    Hi Krsihna,
    refer below code:
    WHERE A~EBELN = I_EBELN. or WHERE b~EBELN = I_EBELN..
    Thanks
    Piyush
    Reward Points, if helpfull

  • INNER JOIN with FOR ALL ENTRIES IN Performance ?

    I am using following the following <b>Select using Inner join with For All Entries in.</b>
          SELECT kebeln kebelp kvbeln kvbelp
            FROM ekkn AS k INNER JOIN ekbe AS b ON kebeln = bebeln
                                               AND kebelp = bebelp
            INTO TABLE gi_purchase
             FOR ALL ENTRIES
             IN gi_sales
          WHERE k~mandt EQ sy-mandt
            AND k~vbeln EQ gi_sales-vbeln
            AND k~vbelp EQ gi_sales-posnr
            AND b~budat EQ p_date.
    If i am not doing inner join then I will have to do 2 select with for all entries in on ekkn and ekbe tables and then compare them.
    <b>I want to know which one has better performance
    Inner join with for all entries in
                    or
    2 Selects with for all entries in</b>

    the join is almost aways faster:
    <a href="/people/rob.burbank/blog/2007/03/19/joins-vs-for-all-entries--which-performs-better">JOINS vs. FOR ALL ENTRIES - Which Performs Better?</a>
    <a href="http://blogs.ittoolbox.com/sap/db2/archives/for-all-entries-vs-db2-join-8912">FOR ALL ENTRIES vs DB2 JOIN</a>
    Rob

  • Inner Join with For All Entries - Performance ?

    I am using following the following <b>Select using Inner join with For All Entries in.</b>
          SELECT kebeln kebelp kvbeln kvbelp
            FROM ekkn AS k INNER JOIN ekbe AS b ON kebeln = bebeln
                                               AND kebelp = bebelp
            INTO TABLE gi_purchase
             FOR ALL ENTRIES
             IN gi_sales
          WHERE k~mandt EQ sy-mandt
            AND k~vbeln EQ gi_sales-vbeln
            AND k~vbelp EQ gi_sales-posnr
            AND b~budat EQ p_date.
    If i am not doing inner join then I will have to do 2 select with for all entries in on ekkn and ekbe tables and then compare them.
    <b>I want to know which one has better performance
    Inner join with for all entries in
                    or
    2 Selects with for all entries in</b><b></b>

    An Inner Join with for all entries should be done if you add this....
    IF NOT gi_sales[] IS INITIAL.
    SELECT k~ebeln k~ebelp k~vbeln k~vbelp
    FROM ekkn AS k INNER JOIN ekbe AS b ON k~ebeln = b~ebeln
    AND k~ebelp = b~ebelp
    INTO TABLE gi_purchase
    FOR ALL ENTRIES
    IN gi_sales
    WHERE k~mandt EQ sy-mandt
    AND k~vbeln EQ gi_sales-vbeln
    AND k~vbelp EQ gi_sales-posnr
    AND b~budat EQ p_date.
    ENDIF.
    Also, while you use an index or the complete key for the SELECT, your not going to suffer from lack of performance -;)
    Greetings,
    Blag.

  • Select SUM( ) in inner join - error in code

    Hi All,
    The following code is using ABAP OO and I get the following error
    E:The addition "FOR ALL ENTRIES" excludes all aggregate functions with
    the exception of "COUNT( * )", as the single element of the SELECT
    clause.
    Here is the Code:
    select a/bic/ZEDM_ENTP amaterial a~/bic/zedm_stid
    a/bic/ZEDM_SDT a/bic/ZEDM_MINH a~/bic/ZEDM_EHD
    SUM( b~/bic/ZEDM_QPLN )
    c~/bic/ZDEMQTY
    from /bic/azdrp_1900 as a inner join /bic/azdrp_0400 as b
    on
    a/bic/ZEDM_ENTP = b/bic/ZEDM_ENTP and
    amaterial = bmaterial and
    a/bic/zedm_stid = bplant and
    a/bic/ZEDM_SDT = b/bic/zedm_pshp
    inner join /bic/azrp_0800 as C
    on
    amaterial = cmaterial and
    a/bic/zedm_stid = c/bic/zedm_stid and
    a/bic/ZEDM_SDT = c/bic/ZEDM_ESDT
    into table z_it_inv for all entries in
    RESULT_PACKAGE where
    a~/bic/ZEDM_ENTP = RESULT_PACKAGE-/bic/ZEDM_ENTP
    and a~material = RESULT_PACKAGE-material
    and a~/bic/ZEDM_SDT = RESULT_PACKAGE-/BIC/OIZEDM_EDT
    and a~/bic/zedm_stid = RESULT_PACKAGE-/BIC/OIZEDM_TOST
    group by b/bic/ZEDM_ENTP bmaterial b~plant
    b~/bic/zedm_pshp
    Can you please tell me how to correct this?
    Thanks

    Hi,
    You can get all records first and then LOOP AT Internal table and use COLLECT statement to sum up required column.
    This will be a better idea than trying to use SUM in SELECT with JOINS.
    ashish

  • Dynamic table name in an inner join - select statement

    Hi,
    Please can you let me know if is possible to use a Dynamic table name in an inner join?
    Something like the statement below? (It works in a simple select statement but not in an inner join)
    SELECT  *
         INTO CORRESPONDING FIELDS OF <t_itab>
          FROM <Dynamic table name> INNER JOIN pa0050 ON
          ( <Dynamic table name>pernr =  pa0050pernr )
           WHERE <Dynamic table name>~pernr = it_pernr-l_pernr
           AND pa0050~bdegr = f_bdegr.
    Any help would be apprecited very much.
    Thanks & Regards.

    Hi,
    Check this link.
    [http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb39c4358411d1829f0000e829fbfe/frameset.htm]
    [Re: accessing dynamic internal table's fields??;
    hope it'll help u.
    Regards,
    Sneha.
    Edited by: sneha kumari on Jun 18, 2009 1:57 PM

  • Select Query with Inner Join

    Dear Experts,
    I have writen a inner join code with MKPF and MSEG which taking too much time, while I have used index.
    Indexes are:
    MSEG
    MATNR
    WERKS
    LGORT
    BWART
    SOBKZ
    MKPF
    BUDAT
    MBLNR
    My Select Query is :
      SELECT B~MATNR
                   B~MAT_KDAUF
                   B~MAT_KDPOS
                   B~BWART
                   B~MENGE
                   B~MEINS
                   B~AUFNR
        INTO TABLE IT_MSEG
        FROM MKPF AS A
          INNER JOIN MSEG AS B
             ON AMBLNR EQ BMBLNR
            AND AMJAHR EQ BMJAHR
        WHERE A~BUDAT IN BUDAT
          AND B~MATNR IN MATNR
          AND B~WERKS IN WERKS
          AND B~LGORT IN LGORT
          AND B~BWART IN BWART.

    hi,
    you can use  for all entries  it will work faster then joins
    About it:*
    FOR ALL ENTRIES WHERE
    Syntax
    ... FOR ALL ENTRIES IN itab WHERE ... col operator itab-comp ...
    Effect
    If the addition FOR ALL ENTRIES is specified before the language element WHERE, then the components comp of the internal table itab can be used as operands when comparing with relational operators.
    The internal table itab must have a structured line type and the component comp must be compatible with the column col.
    The logical expression sql_cond of the WHERE condition can comprise various logical expressions by using AND and OR. However, if FOR ALL ENTRIES is specified, there must be at least one Comparison with a column of the internal table itab, which can be specified either statistically or dynamically (Release 6.40 and higher). In a statement with a SELECTstatement with FOR ALL ENTRIES, the addition ORDER BY can only be used with the addition PRIMARY KEY.
    The whole logical expression sql_cond is evaluated for each individual line of the internal table itab. The resulting set of the SELECT statement is the union of the resulting sets from the individual evaluations. Duplicate lines are automatically removed from the resulting set. If the internal table itab is empty, the whole WHERE statement is ignored and all lines in the database are put in the resulting set.
    Notes
    In Release 6.10 and higher, the same internal table can be specified after FOR ALL ENTRIES and after INTO.
    The addition FOR ALL ENTRIES is only possible before WHERE conditions of the SELECT statement.
    Example
    Exporting all flight data for a specified departure city. The relevant airlines and flight numbers are first put in an internal table entry_tab, which is evaluated in the WHERE condition of the subsquent SELECT statement.
    PARAMETERS p_city TYPE spfli-cityfrom.
    TYPES: BEGIN OF entry_tab_type,
             carrid TYPE spfli-carrid,
             connid TYPE spfli-connid,
           END OF entry_tab_type.
    DATA: entry_tab   TYPE TABLE OF entry_tab_type,
          sflight_tab TYPE SORTED TABLE OF sflight
                           WITH UNIQUE KEY carrid connid fldate.
    SELECT carrid connid
           FROM spfli
           INTO CORRESPONDING FIELDS OF TABLE entry_tab
           WHERE cityfrom = p_city.
    SELECT carrid connid fldate
           FROM sflight
           INTO CORRESPONDING FIELDS OF TABLE sflight_tab
           FOR ALL ENTRIES IN entry_tab
           WHERE carrid = entry_tab-carrid AND
                 connid = entry_tab-connid.
    hope it will help you
    Rahul sharma
    Edited by: RAHUL SHARMA on Sep 11, 2008 8:10 AM

  • Issue when suming the field in Select query using inner join

    Hi All,
    SELECT A~OI_SHNUM
           A~FORWAGENT        
           A~ROUTE
           A~SHTYP
           A~DTSHP_EACT
           A~/BIC/GTCLICENS
           A~/BIC/GTCADD04
           A~COMP_CODE
           SUM( C~GRS_WGT_DL )
           C~UNIT_OF_WT
      INTO TABLE I_LAYONE
      FROM ( ( /BIC/ANTCD000200 AS A
      INNER JOIN /BIC/AGSSD000700 AS B ON BOI_SHNUM = AOI_SHNUM )
      INNER JOIN /BIC/AGSSD000600 AS C ON CDELIV_NUMB = BDELIV_NUMB ).
    I need to sum the field C~GRS_WGT_DL
    While compiling it show the error given below
    The field "C~UNIT_OF_WT" from the SELECT list is is missing in the
    GROUP BY clause. is missing in the GROUP BY clause. is missing in the
    GROUP BY clause. is missing in the GROUP BY clause. is missing in the
    GROUP BY clause. is "C~UNIT_OF_W
    with regards,
    Thambe

    Hi,
    Try the following SQL statement. Hope it helps you.
    SELECT A~OI_SHNUM
    A~FORWAGENT
    A~ROUTE
    A~SHTYP
    A~DTSHP_EACT
    A~/BIC/GTCLICENS
    A~/BIC/GTCADD04
    A~COMP_CODE
    SUM( C~GRS_WGT_DL )
    C~UNIT_OF_WT
    INTO TABLE I_LAYONE
    FROM ( ( /BIC/ANTCD000200 AS A
    INNER JOIN /BIC/AGSSD000700 AS B ON BOI_SHNUM = AOI_SHNUM )
    INNER JOIN /BIC/AGSSD000600 AS C ON CDELIV_NUMB = BDELIV_NUMB )
    GROUP BY
    A~OI_SHNUM
    A~FORWAGENT
    A~ROUTE
    A~SHTYP
    A~DTSHP_EACT
    A~/BIC/GTCLICENS
    A~/BIC/GTCADD04
    A~COMP_CODE.
    Murthy.

  • What is syntax for inner join of Select statement with  Secondary Index

    Hi Genies,
                    Here i have created the Secondary index for table COEP and also used for select query but there is no improvement in runtime . taking same time for select query without index as well as with index. my code is
    SELECT *  INTO CORRESPONDING FIELDS OF TABLE ITAB_COEP FROM COEP AS A
                 INNER JOIN COBK  AS B ON ( A~BELNR = B~BELNR AND A~KOKRS = B~KOKRS AND A~GJAHR = B~GJAHR )
                 WHERE A~OBJNR = OBJNR
                 AND A~GJAHR = CURRY
                 AND B~GJAHR = CURRY
                 AND A~RBEST = ''
                 AND A~BEKNZ = 'S'
                 AND B~BELNR NE WA_COBK-BELNR
                 AND B~AWREF_REV = ''
                 AND B~AWORG_REV = ''
                 AND B~KOKRS = WA_COIOB-KOKRS
                 AND B~BLDAT BETWEEN START_DATE AND END_DATE
                 AND B~BLART IN ('SA','KA','KR','AB')  %_HINTS ORACLE 'INDEX("COEP" "COEP~ZBU")'.
    index name is ZBU.
    please any one let me know is there any syntax mistakes? but while checking and during the runtime it does'nt shows any error.
    Regards,
            Thangam.P

    Hi Genies,
                    Here i have created the Secondary index for table COEP and also used for select query but there is no improvement in runtime . taking same time for select query without index as well as with index. my code is
    SELECT *  INTO CORRESPONDING FIELDS OF TABLE ITAB_COEP FROM COEP AS A
                 INNER JOIN COBK  AS B ON ( A~BELNR = B~BELNR AND A~KOKRS = B~KOKRS AND A~GJAHR = B~GJAHR )
                 WHERE A~OBJNR = OBJNR
                 AND A~GJAHR = CURRY
                 AND B~GJAHR = CURRY
                 AND A~RBEST = ''
                 AND A~BEKNZ = 'S'
                 AND B~BELNR NE WA_COBK-BELNR
                 AND B~AWREF_REV = ''
                 AND B~AWORG_REV = ''
                 AND B~KOKRS = WA_COIOB-KOKRS
                 AND B~BLDAT BETWEEN START_DATE AND END_DATE
                 AND B~BLART IN ('SA','KA','KR','AB')  %_HINTS ORACLE 'INDEX("COEP" "COEP~ZBU")'.
    index name is ZBU.
    please any one let me know is there any syntax mistakes? but while checking and during the runtime it does'nt shows any error.
    Regards,
            Thangam.P

Maybe you are looking for

  • Problem with client_host('cmd /c c:\vbc.bat')

    Hi forum, I am working on Oracle 9i Release 2 Database on AIX 5L based operation system with Oracle 10g AS version 9.0.4 On Windows 2000 Advanced Server and webutil 1.0.6 package, Oracle 10g DS 9.0.4.0.19 for forms developement. I have developed a fo

  • RFC gateway setup in XI and R3

    Hi All, The sceanario is RFC calling target system through XI. Do we need to create one RFC destination in XI and another one in R3 for achieving this. And what are the parameters (gatewayhost, service, program id ) need to be supplied. Much apprecia

  • I am being asked for a serial number when I install CS5

    When I installed Creative Suite 5 Master it asked for a serial number, which I provided. Now it is asking me for a serial number upgrade? This is the master collection being installed for the first time, why is it telling me it can't find qualifying

  • Major bug in Safari 6: previous domain persists in URL bar when clicking a link

    I've noticed an extremely weird and significant bug in Safari 6 / Mountain Lion: When I'm navigating through a site, sometimes when clicking a link, Safari tries to open the corresponding URL on a previously visited site's domain instead of the curre

  • ASA single outside IP address to an inbound NAT pool that round robins request to 2 web servers

    How do I create a single outside IP address 1.2.3.4 to an inbound NAT pool that round robins request to 2 web servers? I have 2 web server 10.0.0.1 and 10.0.0.2. They have the exact same content. I think I start with defining the pool as an object gr