Creating SELECT query between 3 tables

Hi there,
Im trying to create a SELECT query between 3 tables and it is driving me round the bend.
I have 3 tables connected together which are:
MODUL
modulid
modulname
modulevel
STUDENT
studentid
surname
inits
s e x
phone
email
logon
STUDREGOCCUR
modulid
acyear
semester
occletter
studentid
result
I want to select the fields surname, inits, studentid from the STUDENT table, modulname from the MODUL table and result from my STUDREGOCCUR table that is NOT NULL.
I have tried SELECT STUDENT.STUDENTID, STUDENT.INITS, STUDENT.SURNAME, MODUL.MODULNAME, STUDREGOCCUR.RESULT WHERE STUDREGOCCUR.RESULT IS NOT NULL;
I have also tried many other ways and done research hwich hasnt really helped me unfortunately.
Im quite new to SELECT queries and im not sure where im going wrong, i would greatly appreciate if someone could help me solve my problem.
Thanks for the help :)
Edited by: user633643 on 06-Dec-2008 08:09

If you want data from multiple tables you would need to perform a join. The general form would be:
select t1.cola, t2.col2, t3.col.x
from table_a a, table_b b, table_c c
where a.key = b.key
and b.key = c.key
or perhaps c relates back directly to a so it is a.key = c.key where key can be any column whose value is equilivent in what it represents to the value it is being compared to, that is, student_number = student_number or the columns regardless of name are both building numbers, room numbers, etc ....
This is not your exact solution but it should help.
HTH -- Mark D Powell --

Similar Messages

  • Urgent - I have written select query between loop and endloop, Ple help out

    Can any one help out me on this select query. I have written select query between loop and endloop. When I execute the program it will take too much time in this query. Please help me out. Its very urgent.
    LOOP AT l_i_invoices ASSIGNING <l_invoices>.
          CLEAR alv_wa.
          alv_wa-bukrs = <l_invoices>-bukrs.
          alv_wa-gsber = <l_invoices>-gsber.
          CLEAR l_instid.
          CONCATENATE <l_invoices>-belnr <l_invoices>-gjahr INTO l_instid.
          SELECT top_wi_id FROM sww_wi2obj INTO TABLE l_i_swwwihead
                  WHERE catid   = c_catid_business_object
                    AND instid  = l_instid
                    AND typeid  = c_typeid_invoice
                    AND removed = space
                    AND ( wi_rh_task = c_task_buyer_message
                       OR wi_rh_task = c_task_buyer_message2 ).
          IF sy-subrc = 0.
            <l_invoices>-flag = 'X'.
          ELSE.
            <l_invoices>-flag = ' '.
          ENDIF.
          MODIFY l_i_invoices FROM <l_invoices> TRANSPORTING flag
                                WHERE belnr = <l_invoices>-belnr
                                   AND gjahr = <l_invoices>-gjahr.
          APPEND alv_wa TO i_alv.
        ENDLOOP.
    Thanks in advance.

    Here is a way to solve this problem.
    Choose somewhere before this loop processing to use that select. Therefore, you'll need use FOR ALL ENTRIES <that_loop_table> clause, and in the WHERE condition you need to specify that same fields.
    This way, you will have an internal table with all data you'll need to check.
    Then, inside your loop statement, use the READ TABLE command with the clause WITH KEY field = value, to read that record and use the value found.
    Like this sample:
      SELECT bukrs lifnr umsks umskz augdt augbl zuonr gjahr belnr buzei
             waers xblnr blart gsber ebeln zfbdt zbd1t zlsch
      INTO TABLE tg_bsak
      FROM bsak
      FOR ALL ENTRIES IN tl_bkpf_sel
      WHERE bukrs EQ tl_bkpf_sel-bukrs AND
            lifnr IN s_lifnr AND
            augbl EQ tl_bkpf_sel-belnr.
    LOOP AT tg_bseg INTO wa_bseg.
        READ TABLE tg_bsak INTO wa_bsak WITH KEY bukrs = wa_bseg-bukrs
                                                 gjahr = wa_bseg-gjahr
                                                 belnr = wa_bseg-belnr
                                                 BINARY SEARCH.
    if sy-subrc = 0.
    * do something
    endif.
    ENDLOOP.

  • How can I create a query with tables in INFOSET?

    Dear Gurus,
    How can I create a query with tables in INFOSET?
    Just tables and fields INFOSET?
    Kind Regards,

    Hello
    Check following SCN Article for your understanding/reference:
    - [Using Infoset Query ,SAP Query and Quick Viewer|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10eab7af-0e54-2c10-28a5-87b47adbe1a5]
    Regards
    JP

  • Select Query Between two dates...

    Hi Guru's,
    I need a Select Query between two dates, also if the record not found for any in between date then it should return NULL or 0 ...
    for Example
    1. I am having two records in DB for date 2-10-2008 & 4-10-2008
    2. Now suppose I have given Query for date between 1-10-2008 to 5-10-2008
    Then it should return me 5 records with valid values for 2 & 4 and NULL for other 1,3,5
    Thanks.

    Try like this:
    with
      t as
          select date '2008-10-02' as dt, 'Record #1 (in DB)' as str from dual union all
          select date '2008-10-04' as dt, 'Record #2 (in DB)' as str from dual
    select v.dt, t.str
      from (
             select date '2008-10-01' + level - 1 as dt
               from dual
             connect by level <= (date '2008-10-05' - date '2008-10-01') + 1
           ) v
      left join t
        on v.dt = t.dt
    order by 1

  • Query Builder - How to create a link between tables with many fields?

    I have many fields in my tables. When the query builder loads the tables, the tables are expanded to accomodate all the fields. Suppose I want to link Table A's Customer ID (the first field in Table A) wiith Table B's Customer ID (the last field in Table B). How can I do that if the last field in Table B are not visible in the screen?
    Currently, I create a link in Table A's customer with a random field in Table B. Then I edit the link to create a proper condition. Is there a more efficient way to do this?
    Thanks.
    Edited by: woro2006 on Apr 19, 2011 9:40 AM

    Hi woro2006 -
    Easiest way is to grab Table A's title bar & drag Table A down the page until the columns you want to link are visible.
    FYI, there is an outstanding bug
    Bug 10215339: 30EA1: MISSING THE 2.1 RIGHT CLICK OPTIONS ON DATA FIELDS TO CREATE A LINK
    to add a context menu on the field for this. That is, Link {context field} to > {other data sources} > {fields from that source}
    It is being considered for 3.1, but I have no idea where it will end up in the priority queue.
    Brian Jeffries
    SQL Developer Team
    P.S.: Arghh, Unfortunately, I just tried it and the diagram does not auto scroll while you drag, so there is some guess work/repositioning the view involved.
    Logged Bug 12380154 - QUERY BUILDER DIAGRAM DOES NOT AUTO SCROLL WHEN DRAGGING TABLE

  • Select query on table rcv_lots_interface is always returning null

    Hi ,
    I need a help on the below issue.
    The issue is after creating PO in Oracle 11i I receive it in MSCA application.
    When we receive it at that point data gets inserted in the table " rcv_transactions_interface " and we have written a trigger on it.
    From the trigger on table " rcv_transactions_interface " we are calling a package and in the package we have select query on "rcv_lots_interface."
    But the select query is always returning null even though we are passing the correct "interface_transaction_id " and also after the "Receiving Transaction Processor" is executed i can see data in the table " RCV_LOT_TRANSACTIONS " for the same transaction.
    Below is the sample code i am using.
    CREATE OR REPLACE TRIGGER inv.RCV_TRAN_TRIGGER
    AFTER UPDATE
    ON po.rcv_transactions_interface
    FOR EACH ROW
    WHEN (NEW.processing_status_code='PENDING'
    AND NEW.destination_type_code IN ('INVENTORY','RECEIVING')
    AND NEW.mobile_txn = 'Y')
    DECLARE
    PRAGMA AUTONOMOUS_TRANSACTION;
    v_user_id NUMBER;
    v_interface_transaction_id NUMBER;
    v_organization_id NUMBER;
    v_item_id NUMBER;
    v_quantity NUMBER;
    v_resp_id NUMBER;
    v_mobile_txn VARCHAR2(5);
    v_shipment_header_id NUMBER;
    v_bill_of_lading VARCHAR2(100);
    v_group_id NUMBER;
    v_header_interface_id NUMBER;
    BEGIN
    v_interface_transaction_id := :NEW.interface_transaction_id;
    v_organization_id := :NEW.to_organization_id;
    v_user_id := :NEW.created_by;
    v_item_id := :NEW.item_id;
    v_quantity := :NEW.quantity;
    v_resp_id :=fnd_profile.VALUE('RESP_ID');
    v_transaction_type := :NEW.transaction_type;
    v_mobile_txn := :NEW.mobile_txn;
    v_bill_of_lading := :NEW.bill_of_lading;
    v_group_id := :NEW.group_id;
    v_header_interface_id := :NEW.HEADER_INTERFACE_ID;
    INV.INV_RCV_TRX_PKG.INV_RCV_LABEL_GEN_PRC( v_user_id,
    v_interface_transaction_id,
    v_item_id,
    v_quantity,
    v_organization_id,
    v_resp_id,
    v_shipment_header_id,
    v_bill_of_lading,
    v_header_interface_id,
    v_group_id);
    END;
    CREATE OR REPLACE PACKAGE BODY INV.INV_RCV_TRX_PKG
    AS
    PROCEDURE INV_RCV_LABEL_GEN_PRC( p_user_id IN NUMBER,
    p_interface_transaction_id IN NUMBER,
    p_item_id IN NUMBER,
    p_quantity IN NUMBER,
    p_organization_id IN NUMBER,
    p_resp_id IN NUMBER,
    p_shipment_header_id IN NUMBER,
    p_bill_of_lading IN VARCHAR2,
    p_header_interface_id IN NUMBER ,
    p_group_id IN NUMBER
    IS
    v_user_id NUMBER;
    v_print BOOLEAN;
    v_resp_id NUMBER;
    v_resp_appl_id NUMBER;
    v_lot_num VARCHAR2(50);
    BEGIN
    BEGIN
    SELECT application_id
    INTO v_resp_appl_id
    FROM apps.fnd_responsibility_tl frt
    WHERE responsibility_id=p_resp_id;
    END;
    apps.fnd_global.apps_initialize(p_user_id, p_resp_id, v_resp_appl_id);
    BEGIN
    SELECT rli.lot_num , rli.expiration_date
    INTO v_lot_num ,
    v_expiration_date
    FROM apps.rcv_lots_interface rli
    WHERE rli.interface_transaction_id = p_interface_transaction_id ;
    EXCEPTION
    WHEN OTHERS THEN
    v_lot_num :=NULL;
    v_expiration_date :=NULL;
    apps.fnd_file.put_line(fnd_file.log,'Exception while deriving LOT Number ######### '||p_interface_transaction_id||'------'||SQLERRM);
    END;
    END;
    Need your help to understand why the below query is always returning null and what is the solution for it ?
    SELECT rli.lot_num , rli.expiration_date
    FROM apps.rcv_lots_interface rli
    WHERE rli.interface_transaction_id = p_interface_transaction_id ;
    Thanks
    Jaydeep
    Edited by: user10454886 on Mar 25, 2013 6:31 AM
    Hi ,
    I need a solution to this issue at the earliest.
    Appreciate all of your help
    Thanks
    Jaydeep

    Centinul wrote:
    There are a lot of bugs listed in Metalink with respect to wrong results and function-based indexes.
    Here are a few:
    Bug 4028186 Wrong results if function based index exists
    Bug 4717546 Wrong results / poor plan when function based index exists
    Bug 5092688 Wrong results if function based index exists
    Based on reviewing them the workarounds range from dropping the index to setting "_disable_function_based_index" to TRUE.Facinating. It seems to me that if you use the undocumented intitialization parameter you might just as well drop the FBIs too.
    Another hazard of FBIs is the Law of Unintended Consequences. 2 years ago we tried to use one to speed up a query in a PL/SQL package. Worked OK for that purpose, but an unrelated loader on the affected table ran and rand but never finished until the FBI was dropped.

  • Error While Firing select Query  on Table

    Hi aill,
    we have Oracle 11g RG2 RAC on Production Machine. When I am firing select query on one partiton table,it will show me below error in Alter Log file :
    Exception [type: SIGSEGV, Address not mapped to object] [ADDR:0x0] [PC:0x84056AA, kkpamDInfo()+38] [flags: 0x0, count: 1]
    Errors in file /opt/app/oracle/diag/rdbms/winsdb/WINSDB2/trace/WINSDB2_ora_29686.trc (incident=288563):
    ORA-07445: exception encountered: core dump [kkpamDInfo()+38] [SIGSEGV] [ADDR:0x0] [PC:0x84056AA] [Address not mapped to object] []
    Incident details in: /opt/app/oracle/diag/rdbms/winsdb/WINSDB2/incident/incdir_288563/WINSDB2_ora_29686_i288563.trc
    While checking the trace file :
    ========== FRAME [2] (ksedst1()+98 -> skdstdst()) ==========
    defined by frame pointers 0x2ba371efaa40 and 0x2ba371efa990
    CALL TYPE: call ERROR SIGNALED: no COMPONENT: KSE
    RDI 0000000000000000 RSI 0000000000000000 RDX 00002BA371EF6118
    RCX 0000000000000001 R8 0000000000000000 R9 0000000000000000
    RAX 0000000000000000 RBX 0000000000000003 RBP 00002BA371EFAA40
    R10 71EFA9A000000000 R11 0000000000000000 R12 0000000000000003
    R13 0000000000000003 R14 0000000000000001 R15 0000000000000001
    RSP 00002BA371EFA9A0 RIP 000000000349E72E
    Dump of memory from 0x2ba371efaa40 to 0x2ba371efaaf0
    2BA371EFAA40 71EFAB10 00002BA3 0349E77F 00000000 [...q.+....I.....]
    2BA371EFAA50 00000000 00000000 00000000 00000000 [................]
    2BA371EFAA60 71B996F0 00002BA3 02050034 00000000 [...q.+..4.......]
    2BA371EFAA70 000000FF 00002BA3 00002004 00000000 [.....+... ......]
    2BA371EFAA80 00000000 00000000 2338D058 00016DAB [........X.8#.m..]
    2BA371EFAA90 00000003 00000000 085232F3 00000000 [.........2R.....]
    2BA371EFAAA0 0000000D 00000000 00000002 00000000 [................]
    2BA371EFAAB0 00000000 00000000 00000000 00000000 [................]
    2BA371EFAAC0 71EFAAD0 00002BA3 085BBFCF 00000000 [...q.+....[.....]
    2BA371EFAAD0 71EFAB10 00002BA3 0349E249 00000000 [...q.+..I.I.....]
    2BA371EFAAE0 00000000 00002BA3 00000013 00000000 [.....+..........]
    Can Anyone guide me for above Errors. How can I resolve the same.

    A quick search of Oracle Support shows that there are a handful of bugs that match ORA-07445 with an argument of kkpamDInfo()+38.
    Whether yours is already identified and patched depends on the exact version of 11.2 and the specific circumstances.
    If you're on 11.2.0.1 then this might be part of what sounds like quite a big bucket of such errors - Bug 9399991 relating to errors and dumps with SQL against partitioned tables.

  • Plz help, A select query for table giving foll o/p

    A table has a single column with following data
    Col1
    170
    10
    140
    520
    20
    60
    70
    The select query should return the data in the following format
    Col1 Col2 Col3 Col4
    170 3 1 0
    10 0 0 1
    140 2 2 0
    520 10 1 0
    20 0 1 0
    60 1 0 1
    70 1 1 0

    Using my awesome puzzle solving brain I note that Col2 = 50 Col3 = 20 Col4 = 10.
    But you should be telling US that.
    select col1, floor(col1/50) col2, floor(mod(col1,50)/20) col3, floor(mod(mod(col1,50),20)/10) col4
    from mytable.
    I win the internets!
    Edited by: Dave Hemming on Dec 19, 2008 11:35 AM

  • Select Query LQUA Table

    Hi Experts
    Can Any one tell me ,
    Is there anything wrong in this select query, As per my knoledge everything is Fine, But Still i am getting SY-SUBRC = 4 for this Query,
    Its a Warehouse Management table LQUA i have Used.
    TABLES:mara,lqua.
    *Internal Table And Work Area Declearation
    DATA: it_lqua1 TYPE TABLE OF lqua WITH HEADER LINE.
    DATA: wa_tmp_lqua TYPE lqua.
    CONSTANTS: c_x TYPE char1 VALUE 'X',
               c_t TYPE char1 VALUE 'Q'.
    *Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    PARAMETERS:P_HLDR TYPE lqua-Z_HLDREF1.
    SELECT-OPTIONS:s_matnr FOR mara-matnr,
                   s_date  FOR sy-datum DEFAULT sy-datum,
                   s_mfgt  FOR sy-uzeit DEFAULT sy-uzeit,
                   s_CHARG FOR lqua-CHARG.
    SELECTION-SCREEN END OF BLOCK blk1.
    START-OF-SELECTION.
    Select * from LQUA
                into table IT_LQUA1
                where MATNR in S_MATNR
                and BDATU in S_DATE
                and Z_MFGTIM in S_MFGT
                   AND CHARG IN S_CHARG.
    After Debuging Above Query I am Getting SY-SUBRC = 4.
    Same data is availabe In LQUA Table For Selection Criteria..
    Please help me if anyone has worked on WM LQUA Table

    Hi
    as per your code you are mentioning S_DATE and S_MFGT which is system date and username.
    i beleive you do not have data for this user name and this date in your table LQUA. that why you are getting sy-subrc = 4
    because all this is in the where condition with AND operator. So all the conditions should be matched otherwise you will not find any data.
    so check your table once again for the given values, like your system date and the current user name.
    Thanks
    Lalit Gupta

  • Need pointers to improve performance of a select query to table vbrk

    Hey Folks,
    I have a query , whose performance needs to be tuned , as such:
        SELECT a~vbeln
               a~fkart                    
               a~waerk
               a~fkdat                   
               b~posnr
               b~vgbel
               b~vgpos
               b~matnr
               b~arktx
               b~prctr
               b~txjcd
          INTO TABLE gi_billing_items
          FROM vbrk AS a
          INNER JOIN vbrp AS b
          ON a~vbeln = b~vbeln
          FOR ALL ENTRIES IN gi_sales_items
         WHERE b~vgbel = gi_sales_items-vbeln
           AND b~vgpos  = gi_sales_items-posnr
           AND b~matnr  = gi_sales_items-matnr
           AND b~werks  = gi_sales_items-werks.
    where
    gi_sales_items is an internal table consisting of 278 entries,.
    The result set collected in table gi_billing_items is 200 records
    The total execution time for this query for the afore given data is 72,983 ms with the average time/record being ~ 9,471 ms which is too high.
    When I try to verify the Explain Plan of the query in ST05, in the Access path I see that the performance of Query Block 1 is bad. Query Block 1 is of the QBLOCK_TYPE UNIONA. Its the very first step in the Query execution internally.
    The indexes are defined on participating tables VBRK and VBRP as:
    VBRK~0      MANDT,VBELN
    VBRK~LOC MANDT,LCNUM
    VBRP~0      MANDT,VBELN,POSNR
    VBRP~Z01   FPLNR,MANDT
    VBRP~Z02   MANDT,MATNR,WERKS
    Its clear from the ST05, STAD and SE30 traces that there is a performance issue in this query. Does anyone have any pointers as to how to resolve this issue? Is there a protocol one needs to follow when using the "FOR ALL ENTRIES IN" clause? Or is there a need for any secondary indexes to be created?
    Please let me know
    Thanks and Best Regards,
    Rashmi.

    Hi,
    Try using the VBFA...to get the Invoice number and line item..and then use that value in VBRK...
    * Declare the internal table for T_VBFA.
    IF NOT gi_sales_items[] IS INITIAL.
    SELECT VBELV
                  POSNV
                  VBELN
                  POSNN
                  VBTYP_N
                  INTO TABLE T_VBFA
                  FOR ALL ENTRIES IN gi_sales_items
                  WHERE VBELV = gi_sales_items-VBELN
                  AND       POSNV = gi_sales_items-POSNR
                  AND       VBTYP_N = 'M'.             "Invoice                       ""Added this..
    ENDIF.
    **Add two columns to GI_SALES_ITEMS..to store the VBELN POSNN the data from t_vbfa..let's assume it is VBELN_VF and POSNR_VF
    * Basically merge gi_sales_items AND t_vbfa
    ** Then use that field in
    IF NOT GI_SALES_ITEMS[] IS INITIAL.
          SELECT a~vbeln
               a~fkart                    
               a~waerk
               a~fkdat                   
               b~posnr
               b~vgbel
               b~vgpos
               b~matnr
               b~arktx
               b~prctr
               b~txjcd
          INTO TABLE gi_billing_items
          FROM vbrk AS a
          INNER JOIN vbrp AS b
          ON a~vbeln = b~vbeln
          FOR ALL ENTRIES IN gi_sales_items
          WHERE b~vbeln = gi_sales_items-vbeln_vf   " Change here
           AND b~posnr  = gi_sales_items-posnr_vf     " Change here
           AND b~matnr  = gi_sales_items-matnr
           AND b~werks  = gi_sales_items-werks.
    ENDIF.
    Thanks
    Naren
    Edited by: Narendran Muthukumaran on Oct 15, 2008 11:35 PM

  • SELECT query & Database Table Difference in number of records

    Hi All,
    In program it’s selecting 3 records based on selection parameters whereas when i execute SE16 with same selection criteria gives 4 records.
    Please suggest when we will face these kind of issue
    Thanks,
    Spandana

    SELECT objnr wlges
    FROM bpge
    INTO TABLE t_bpge
    FOR ALL ENTRIES IN t_prps
    WHERE lednr  EQ c_0002
    AND      objnr  EQ t_prps-objnr
    AND      wrttp  EQ c_41.
    Here t_prps-objnr has the following values
    PR00473170
    PR00397060
    PR00397061
    PR00397062
    PR00397063
    PR00397064
    PR00397065
    For this selection criteria there are 4 records in BPGE table where as the program is fetching only 3

  • Query between two tables : COAS and BPGE

    Hi,
    I want to create a Query between tables : COAS and BPGE but when i generate the Info-set the system had a problem of jointure. (the field OBJNR exist in the both)
    By this query i want to display the Order and the value of Budget
    Please Advise
    Regards

    hi..
    you can go with following type of code....
    select  coas~field1
               coas~field2
               bpge~field5
               bpeg~field6
    from    coas inner/outer join bpge
      on     coasobjnr = bpgeobjnr
    into      table t_table
    where condition
    hope this one will solve the issue
    regards

  • Select query differences between oracle 9 and oracle 8.

    Hi,
    I have a problem using the select query between oracle 7 and oracle 9i I don't have the same result :
    ex:
    With oracle7
    SQL> select 'champ1','champ2' from DUAL;
    'CHAMP 'CHAMP
    champ1 champ2
    With Oracle 9
    SQL> select 'champ1','champ2' from DUAL;
    'CHAMP1' 'CHAMP2'
    champ1 champ2
    So Can someone tell me how to solve this problem ? Is there a parameter in oracle 9 to set?
    Thanx.

    Whenever you are posting anything over internet forums like this - you should be very careful about not just posting the details which requires to solve the problem - also should be sensible about your question.
    This is not at all desired when you are posting such question. It may be because - you may not well aware of the fact.
    My suggestion is -> First Go through the basics Of SQL in general.
    Then go for any specific product like Oracle/ SQL Server/ Sybase etc.
    And, finally learn the advanced commands of that DB.
    You asked it - may be you thought the difference in output in terms of lines. But, that is not your actual output. That is the graphical display part only.
    Anyway,
    You can get the quite familier output by first type the following command ->
    set lin 310Regards.
    Satyaki De.

  • Select query based on joining of tables from different database is taking too long

    Hi Team,
    Select query on table with millions of records is taking very long time. It took 50mins, the below query is joining on multiple table from two databases DB1.dbo.Table1 contains 100 million records and also Table3 and Table4 (of different database) might
    contain close to 1million records.
    Select T1.*
    From DB1.dbo.Table1 T1
    Join DB1.dbo.Table2 T2 on RTRIM(T1.Col3) = RTRIM(T2.Col3)
    Join Table4 CA on RTRIM(T1.Col1) + T2.Col2 = CA.Col1
    Join Table3 U on CA.Col2 = U.Col2 AND RTRIM(T2.Col2) = U.Col3
    Where U.Col4 NOT IN ('A1', 'A2', 'A3', 'A4', 'A5', 'A6','A7','A8','A9')
    And (T1.flg IS NULL OR T1.flg = 'N')
    And LTRIM(RTRIM(T2.Col2)) NOT IN ('B1','B2')
    How can i improve the performance of this query. Actual thing is update the data in Db1.dbo.table1 based on the conditions but if the select is taking close to 1hr then update will take hours together. Indexes already implemented on all the tables.
    Thanks,
    Eshwar.
    Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.

    Thanks.
    Join Table4 CA on RTRIM(T1.Col1) + T2.Col2 = CA.Col1
    This join is not working with spaces if Rtrim is not used.
    Thanks! Eshwar.
    Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.

  • ST05 Trace on a select query on BSEG table

    hi all,
    this is my select query on table BSEG table:
      SELECT bukrs
             belnr
             gjahr
             buzei
             KOART
             mwskz
             kostl
             lifnr
             aufnr
             werks
             ebeln
             txjcd
             projk FROM bseg
                   INTO TABLE i_bseg
                   FOR ALL ENTRIES IN i_ad_tab
                  WHERE bukrs EQ i_ad_tab-bukrs  AND
                        belnr EQ i_ad_tab-belnr  AND
                        gjahr EQ i_ad_tab-gjahr.
    when i m doing SQL trace ST05 on this query and in the detail statement showed the following query
    SELECT
      "MANDT" , "BUKRS" , "BELNR" , "GJAHR" , "PAGENO" , "TIMESTMP" ,
      "PAGELG" , "VARDATA"
    FROM
      "RFBLG"
    WHERE
      "MANDT" = ? AND  "BUKRS" = ? AND  "BELNR" = ? AND  "GJAHR" = ?
    ORDER BY
      "MANDT" , "BUKRS" , "BELNR" , "GJAHR" , "PAGENO"
    what is RFBLG table in SE11, but could not find it.
    what is RFBLG?also, the above select query giving me performance issues.. the "for all entries" clause is used as per norms...
    please suggest a solution..

    hi
    good
    The famous BSEG table is a cluster table.
    It is as was correctly stated part of the Accounting Document Segment. It is part of the Pool cluster RFBLG and lives in the package: FBAS (Financial accounting 'Basis').
    You can't read a cluster table exactly the way you read a database (old speak, transparent table).
    You can use a program to read called RFPPWF05
    Note 435694: Display BSEG item by calling FB09D (modified FB09)
    Other possiblity: Other possibility: CALL DIALOG 'RF_ZEILEN_ANZEIGE', but since this is a dialog I don't think this would work.
    In any event go to FBAS Package (development class) to see your business objects, class library and functions.
    you must use keyfields bukrs , belnr, gjahr
    (so 1st select table bkpf) to select bseg.
    or use secondary index tables:
    bsas, bsis, bsik, bsak, bsid, bsad
    Regards,
    Raj.

Maybe you are looking for

  • Is anyone else observing black lines all around applications windows in Mavericks?

    Note that when I am in application windows am observing lines around my applistion windows as if there ewre multiple echos of the window and this happened since I upgraded from Mountain Lion to Mavericks.  I will attempt to insert a screen shot of th

  • X2-01 blank screen

    Hi..today my x2-01's screen became blank..it getting on,but only keypad lights on,screen not getting on.it just blank screen.i didn't fell it down anywhere.today i received a message,when i try to open it,it's screen becomes blank.i tried everything,

  • PSE can not create layers from Aperture reference

    I'm still working out how to use Aperture (just got it) and I can't figure this one out. No matter how I try and export an image to Photoshop (tried using PSD & TIFF standard and 16 bit) , PSE will NOT allow me to create duplicate a layer from teh ba

  • Macbook pro 15 unexpectidly shuts down

    I leave my macbook on in a stand with with it on standby and each time I open it to log in, the computer states that it crashes and has to restart. Are there any apps to check this on my laptop?

  • Synching a Treo650and Centro with same computer

    I have been using a Treo650 and have been synching it with my PC (Win XP Pro SP2) for many years. There are also some 3rd party apps on it. I have recently acquired a Centro which has a CDMA phone in it. I want to carry on using the Treo as phone+PDA