Unable to retrive data from two tables using multiple joins

Hi,
Table:   EMP mgr 
eid              name
eid mgrid
1
A 1
null
2
B 2
3
3
C 3
3
i need to get result as:
eid ename mgrname
thanks
AVS

Sai,
It would be very helpful if you could mention your table structures a bit more clearly. Would allow for effective replies from fellow users as well. :) 
However, assuming that your structure would be as follows presenting the query as below:
DECLARE @Emp TABLE(Eid Int, ename Varchar(50))
DECLARE @Emp_Mgr TABLE(Eid int, mgrid int null )
INSERT INTO @Emp select 1,'Ram'
INSERT INTO @Emp select 2,'Shyam'
INSERT INTO @Emp_Mgr select 1,NULL
INSERT INTO @Emp_Mgr select 2,1
SELECT * FROM @Emp
SELECT * FROM @Emp_Mgr
Query to print results as EID, ENAME, MGRNAME
SELECT em.eid,e1.ename as ENAME,e2.ename as MGRNAME
FROM @Emp_Mgr em
JOIN @Emp e1 ON em.eid=e1.eid
JOIN @Emp e2 ON em.mgrid=e2.eid
However, as you see this approach of maintaining two tables for preserving the employee-manager data is redundant and makes the queries unnecessarily complex. So, you could opt for the widely used single table format as mentioned by Praveen as well. Check
if this helps you..
Recommended Structure
*Avoidance of redundant storage of data
*Lesser Joins in queries
DECLARE @Emp TABLE(Eid Int , Ename Varchar(50) , mgrid int null )
INSERT INTO @Emp(Eid , ename , mgrid) values(1 , 'Ram' , null) , (2 , 'Shyam' , 1)
SELECT * FROM @Emp
Query to print results as EID, ENAME, MGRNAME
SELECT e.Eid , e.Ename , m.Ename as MgrName
FROM @Emp e
JOIN @Emp m On a.mgrid = b.eid
Thanks,
Jay
<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

Similar Messages

  • Retrive data from two tables into one internal table.

    Hi SDN,
    I am downloading the Assets data from two tables ANLA,ANLZ.
    there is a common field ANL1in both tables and i have to retrive the data by using anl1 into the internal table.
    can you please send me the SELECT Syntax for this probl.....
    Thank you & Regards,
    Manoj

    Hi manoj,
    Please see the following sample code. But kindly don't use join as it may hamper ur performance. No trouble in using two select query.
    data: begin of itab occurs 0,
            BUKRS like anla-BUKRS,
            ANLN1 like anla-ANLN1,
           BDATU like anlz-BDATU,
            end of itab.
    select anlabukrs anlaANLN1 anlzBDATU  into corresponding fields of table itab from anla inner join anlz on anlaanl1 eq anlz~anl1 where (logexp).
    Please come back for any clarification.
    Thanks and Regards,
    saurabh

  • Retrive data from two tables

    Hi ,
    I have two tables, we want to retrive data from both the tables please see example below
    Table 1
    A B X Y Z
    1 2
    Table B
    A B C
    1 2 5
    1 2 6
    1 2 7
    I want output like
    A B C
    1 2 5
    Null Null 6
    Null Null 7
    Regards
    Message was edited by:
    rajib.sarkar

    Could you explain the logic behind that?

  • Retriving data  from two tables at a time.

    Please use this forum to provide feedback about OTN content/services. All other posts will be DELETED.
    hi all,
    Am using win98 and Oracle 7.
    I have splitted a table into two tables having 10 and 9 fields respectively and records of 2000.Now in form builder I have put both tables in same block and on same canvas.
    Now when I execute a query I retrieve records of 1st table and can navigate through records of 1st table only .To retrive records of 2nd table I have to put curser in 2nd table and query again for data retrival from 2nd table.This is bothering me to match coulmn of both tables.
    Is there any way to execute the records of both tables at a time, so that matching coulmns of both tables would become easy to reach.
    Thanks and Regards

    heeeey mohammad
    you have first to make master/detail block not one block only
    then jion between them as pk and fk

  • Creating a external content type for Read and Update data from two tables in sqlserver using sharepoint designer

    Hi
    how to create a external content type for  Read and Update data from two tables in  sqlserver using sharepoint designer 2010
    i created a bcs service using centraladministration site
    i have two tables in sqlserver
    1)Employee
    -empno
    -firstname
    -lastname
    2)EmpDepartment
    -empno
    -deptno
    -location
    i want to just create a list to display employee details from two tables
    empid firstname deptno location
    and same time update  in two tables
    adil

    When I try to create an external content type based on a view (AdventureWorks2012.vSalesPerson) - I can display the data in an external list.  When I attempt to edit it, I get an error:
    External List fails when attached to a SQL view        
    Sorry, something went wrong
    Failed to update a list item for this external list based on the Entity (External Content Type) 'SalesForce' in EntityNamespace 'http://xxxxxxxx'. Details: The query against the database caused an error.
    I can edit the view in SQL Manager, so it seems strange that it fails.
    Any advice would be greatly GREATLY appreciated. 
    Thanks,
    Randy

  • Retrive data from 4 tables without using joins

    hi ,
    i have to retrive data from 4 tables........but i donot want to use joins because of performance issues.
    please guide me how to proceed further ?
    thanks

    hi manish,
    CONSTANTS: c_act_plan(2)    TYPE c VALUE 'U1'      ,
               c_person(1)      TYPE c VALUE 'P'       ,
               p1_betid(8)      TYPE c VALUE '50005316',
               c_topdown(1)     TYPE c VALUE 'A'       ,
               c_admnby(3)      TYPE c VALUE '032'     ,
               c_bet_type(1)    TYPE c VALUE 'Q'       ,
               c_firmed(1)      TYPE c VALUE '1'       ,
               c_subtyp_mail(4) TYPE c VALUE '0001'    .
    TYPES: BEGIN OF ty_hrp1001,
             objid TYPE hrp1001-objid,
           END OF ty_hrp1001,
           BEGIN OF ty_pa0001,
             pernr TYPE pa0001-pernr,
             subty TYPE pa0001-subty,
             objps TYPE pa0001-objps,
             sprps TYPE pa0001-sprps,
             endda TYPE pa0001-endda,
             begda TYPE pa0001-begda,
             seqnr TYPE pa0001-seqnr,
             werks TYPE pa0001-werks,
             gsber TYPE pa0001-gsber,
             btrtl TYPE pa0001-btrtl,
           END OF ty_pa0001,
           BEGIN OF ty_t500p,
             persa TYPE t500p-persa,
             name1 TYPE t500p-name1,
           END OF ty_t500p,
           BEGIN OF ty_t001p,
             werks TYPE t001p-werks,
             btrtl TYPE t001p-btrtl,
             btext TYPE t001p-btext,
           END OF ty_t001p,
           BEGIN OF ty_pa0002,
             pernr TYPE pa0002-pernr,
             subty TYPE pa0002-subty,
             objps TYPE pa0002-objps,
             sprps TYPE pa0002-sprps,
             endda TYPE pa0002-endda,
             begda TYPE pa0002-begda,
             seqnr TYPE pa0002-seqnr,
             nachn TYPE pa0002-nachn,
             vorna TYPE pa0002-vorna,
           END OF ty_pa0002,
           BEGIN OF ty_pa0105,
             pernr      TYPE pa0105-pernr     ,
             subty      TYPE pa0105-subty     ,
             objps      TYPE pa0105-objps     ,
             sprps      TYPE pa0105-sprps     ,
             endda      TYPE pa0105-endda     ,
             begda      TYPE pa0105-begda     ,
             seqnr      TYPE pa0105-seqnr     ,
             usrid_long TYPE pa0105-usrid_long,
           END OF ty_pa0105,
           BEGIN OF ty_output,
             pernr      TYPE pa0002-pernr     ,
             werks      TYPE pa0001-werks     ,
             gsber      TYPE pa0001-gsber     ,
             btrtl      TYPE pa0001-btrtl     ,
             name1      TYPE t500p-name1      ,
             btext      TYPE t001p-btext      ,
             nachn      TYPE pa0002-nachn     ,
             vorna      TYPE pa0002-vorna     ,
             usrid_long TYPE pa0105-usrid_long,
           END OF ty_output.
    DATA: w_hrp1001     TYPE                 ty_hrp1001,
          t_hrp1001     TYPE        TABLE OF ty_hrp1001,
          t_hrp1001_tmp TYPE        TABLE OF ty_hrp1001,
          w_pa0001      TYPE                 ty_pa0001 ,
          t_pa0001      TYPE SORTED TABLE OF ty_pa0001
            WITH NON-UNIQUE KEY pernr                  ,
          t_pa0001_tmp  TYPE        TABLE OF ty_pa0001 ,
          w_t500p       TYPE                 ty_t500p  ,
          t_t500p       TYPE HASHED TABLE OF ty_t500p
            WITH UNIQUE KEY persa                      ,
          w_t001p       TYPE                 ty_t001p  ,
          t_t001p       TYPE HASHED TABLE OF ty_t001p
            WITH UNIQUE KEY werks btrtl                ,
          w_pa0002      TYPE                 ty_pa0002 ,
          t_pa0002      TYPE SORTED TABLE OF ty_pa0002
            WITH NON-UNIQUE KEY pernr                  ,
          t_pa0002_tmp  TYPE        TABLE OF ty_pa0002 ,
          w_pa0105      TYPE                 ty_pa0105 ,
          t_pa0105      TYPE SORTED TABLE OF ty_pa0105
            WITH NON-UNIQUE KEY pernr                  ,
          w_output      TYPE                 ty_output ,
          t_output      TYPE        TABLE OF ty_output .
    SELECT objid
      FROM hrp1001
      INTO TABLE t_hrp1001
      WHERE otype EQ c_person
      AND   plvar EQ c_act_plan
      AND   rsign EQ c_topdown
      AND   relat EQ c_admnby
      AND   istat EQ c_firmed
      AND   begda LE sy-datum
      AND   endda GT sy-datum
      AND   sclas EQ c_bet_type
      AND   sobid EQ p1_betid.
    IF sy-subrc EQ 0.
      SORT t_hrp1001 BY objid.
    ENDIF.
    IF NOT t_hrp1001[] IS INITIAL.
      t_hrp1001_tmp[] = t_hrp1001[].
      DELETE ADJACENT DUPLICATES FROM t_hrp1001_tmp
        COMPARING objid.
      SELECT pernr
             subty
             objps
             sprps
             endda
             begda
             seqnr
             werks
             gsber
             btrtl
        FROM pa0001
        INTO TABLE t_pa0001
        FOR ALL ENTRIES IN t_hrp1001_tmp
        WHERE pernr EQ t_hrp1001_tmp-objid
        AND   endda GT sy-datum
        AND   begda LE sy-datum.
      SELECT pernr
             subty
             objps
             sprps
             endda
             begda
             seqnr
             nachn
             vorna
        FROM pa0002
        INTO TABLE t_pa0002
        FOR ALL ENTRIES IN t_hrp1001_tmp
        WHERE pernr EQ t_hrp1001_tmp-objid
        AND   endda GT sy-datum
        AND   begda LE sy-datum.
    ENDIF.
    IF NOT t_pa0001[] IS INITIAL.
      t_pa0001_tmp[] = t_pa0001[].
      SORT t_pa0001_tmp BY werks btrtl.
      DELETE ADJACENT DUPLICATES FROM t_pa0001_tmp COMPARING werks btrtl.
      SELECT werks
             btrtl
             btext
        FROM t001p
        INTO TABLE t_t001p
        FOR ALL ENTRIES IN t_pa0001_tmp
        WHERE werks EQ t_pa0001_tmp-werks
        AND   btrtl EQ t_pa0001_tmp-btrtl.
      DELETE ADJACENT DUPLICATES FROM t_pa0001_tmp COMPARING werks.
      SELECT persa
             name1
        FROM t500p
        INTO TABLE t_t500p
        FOR ALL ENTRIES IN t_pa0001_tmp
        WHERE persa EQ t_pa0001_tmp-werks.
    ENDIF.
    IF NOT t_pa0002[] IS INITIAL.
      t_pa0002_tmp[] = t_pa0002[].
      DELETE ADJACENT DUPLICATES FROM t_pa0002_tmp COMPARING pernr.
      SELECT pernr
             subty
             objps
             sprps
             endda
             begda
             seqnr
             usrid_long
        FROM pa0105
        INTO TABLE t_pa0105
        FOR ALL ENTRIES IN t_pa0002_tmp
        WHERE pernr EQ t_pa0002_tmp-pernr
        AND   subty EQ c_subtyp_mail
        AND   endda GT sy-datum
        AND   begda LE sy-datum
        AND   usrty EQ c_subtyp_mail.
    ENDIF.
    REFRESH t_output.
    LOOP AT t_hrp1001 INTO w_hrp1001.
      LOOP AT t_pa0001 INTO w_pa0001
        WHERE pernr EQ w_hrp1001-objid.
        READ TABLE t_t500p INTO w_t500p WITH KEY persa = w_pa0001-werks
                                                 TRANSPORTING
                                                   name1.
        CHECK sy-subrc EQ 0.
        READ TABLE t_t001p INTO w_t001p WITH KEY werks = w_pa0001-werks
                                                 btrtl = w_pa0001-btrtl
                                                 TRANSPORTING
                                                   btext.
        LOOP AT t_pa0002 INTO w_pa0002
          WHERE pernr EQ w_hrp1001-objid.
          LOOP AT t_pa0105 INTO w_pa0105
            WHERE pernr EQ w_pa0002-pernr.
            w_output-pernr      = w_pa0002-pernr     .
            w_output-werks      = w_pa0001-werks     .
            w_output-gsber      = w_pa0001-gsber     .
            w_output-btrtl     = w_pa0001-btrtl      .
            w_output-name1      = w_t500p-name1      .
            w_output-btext      = w_t001p-btext      .
            w_output-nachn      = w_pa0002-nachn     .
            w_output-vorna      = w_pa0002-vorna     .
            w_output-usrid_long = w_pa0105-usrid_long.
            APPEND w_output TO t_output.
            CLEAR w_output.
          ENDLOOP.
        ENDLOOP.
      ENDLOOP.
    ENDLOOP.
    Reward if usful,
    Thanks,
    Srikanth.A

  • Need help to join two tables using three joins, one of which is a (between) date range.

    I am trying to develop a query in MS Access 2010 to join two tables using three joins, one of which is a (between) date range. The tables are contained in Access. The reason
    the tables are contained in access because they are imported from different ODBC warehouses and the data is formatted for uniformity. I believe this cannot be developed using MS Visual Query Designer. I think writing a query in SQL would be suiting this project.
    ABCPART links to XYZPART. ABCSERIAL links to XYZSERIAL. ABCDATE links to (between) XYZDATE1 and ZYZDATE2.
    [ABCTABLE]
    ABCORDER
    ABCPART
    ABCSERIAL
    ABCDATE
    [ZYXTABLE]
    XYZORDER
    XYZPART
    XYZSERIAL
    XYZDATE1
    XYZDATE2

    Thank you for the looking at the post. The actual table names are rather ambiguous. I renamed them so it would make more sense. I will explain more and give the actual names. What I do not have is the actual data in the table. That is something I don't have
    on this computer. There are no "Null" fields in either of the tables. 
    This table has many orders (MSORDER) that need to match one order (GLORDER) in GLORDR. This is based on MSPART joined to GLPART, MSSERIAL joined to GLSERIAL, and MSOPNDATE joined if it falls between GLSTARTDATE and GLENDDATE.
    [MSORDR]
    MSORDER
    MSPART
    MSSERIAL
    MSOPNDATE
    11111111
    4444444
    55555
    2/4/2015
    22222222
    6666666
    11111
    1/6/2015
    33333333
    6666666
    11111
    3/5/2015
    This table has one order for every part number and every serial number.
    [GLORDR]
    GLORDER
    GLPART
    GLSERIAL
    GLSTARTDATE
    GLENDDATE
    ABC11111
    444444
    55555
    1/2/2015
    4/4/2015
    ABC22222
    666666
    11111
    1/5/2015
    4/10/2015
    AAA11111
    555555
    22222
    3/2/2015
    4/10/2015
    Post Query table
    GLORDER
    MSORDER
    GLSTARTDATE
    GLENDDATE
    MSOPNDATE
    ABC11111
    11111111
    1/2/2015
    4/4/2015
    2/4/2015
    ABC22222
    22222222
    1/5/2015
    4/10/2015
    1/6/2015
    ABC22222
    33333333
    1/5/2015
    4/10/2015
    3/5/2015
    This is the SQL minus the between date join.
    SELECT GLORDR.GLORDER, MSORDR.MSORDER, GLORDR.GLSTARTDATE, GLORDR.GLENDDATE, MSORDR.MSOPNDATE
    FROM GLORDR INNER JOIN MSORDR ON (GLORDR.GLSERIAL = MSORDR.MSSERIAL) AND (GLORDR.GLPART = MSORDR.MSPART);

  • To Select the data from two table one is transp table and onther is cluster

    Hi All,
    I want to select the data from two tables
    Here i am giving with an example.
    Fileds: kunnr belnr from bseg.  table bseg
    fields: adrnr from kna1     table: kna1.
    Know i want to put these into one internal table based on kunnr and belnr.
    Thanks in advance.
    Ramesh

    Hi,
       U cant use joins on cluster table and BSEG is a cluster table so use FOR  ALL ENTRIES for taht
    refer this code
    *&      Form  sub_read_bsak
          text
    -->  p1        text
    <--  p2        text
    FORM sub_read_bsak.
    *--Select data from BSAK Table
      SELECT lifnr
             augdt
             augbl
             gjahr
             belnr
             xblnr
             blart
             dmbtr
             mwskz
             mwsts
             sgtxt
             FROM bsak
             INTO CORRESPONDING FIELDS OF TABLE it_bsak
             WHERE belnr IN s_belnr
             AND   augdt IN s_augdt.
      IF sy-subrc EQ 0.
    *--Sort table by accounting document and vendor number
        SORT it_bsak BY belnr lifnr.
      ENDIF.
    ENDFORM.                    " sub_read_bsak
    *&      Form  sub_read_bseg
          text
    -->  p1        text
    <--  p2        text
    FORM sub_read_bseg.
      IF NOT it_bsak[] IS INITIAL.
    *--Select data from BSEG table
        SELECT belnr
               gjahr
               shkzg
               kostl
               hkont
               ebeln
               ebelp
               FROM bseg
               INTO CORRESPONDING FIELDS OF TABLE it_bseg
               FOR ALL ENTRIES IN it_bsak
               WHERE belnr EQ it_bsak-belnr
               AND   gjahr EQ it_bsak-gjahr
               AND   shkzg EQ 'S'.
        IF sy-subrc EQ 0.
    *--Sort table by accounting document
          SORT it_bseg BY belnr.
        ENDIF.
      ENDIF.
    ENDFORM.                    " sub_read_bseg

  • Select data from two tables...!

    HI Experts...!
    i m a beginner user and i want to select data from two tables proj and prps.....using joins.....and internal tables i have written a code...
    SELECT prps~pspnr
           prps~objnr
           prps~psphi
           proj~ernam
           proj~erdat
           proj~pspnr
    INTO  table itab   -
    itab is internal table
    FROM prps inner join proj
    WHERE pspnr in p_no and prpspsphi = projpspnr.
    but there is error in from clause ..please help me....
    Advance thanx....

    Hi,
    check the sample code bellow above two reply will solve out your problem but one more extra line in your code pointed out bellow.
    TABLES: prps, proj.
    TYPES:  BEGIN OF ty_test,
            pspnr LIKE prps-pspnr,
            objnr LIKE prps-objnr,
            psphi LIKE prps-psphi,
            ernam LIKE proj-ernam,
            erdat LIKE proj-erdat,
            END OF ty_test.
    DATA: itab TYPE STANDARD TABLE OF ty_test WITH HEADER LINE.
    SELECT-OPTIONS: p_no FOR prps-pspnr.
    SELECT  prps~pspnr
            prps~objnr
            prps~psphi
            proj~ernam
            proj~erdat
    *        proj~pspnr " No need for this you have selected this in
    *     the first line because it is commone so you only need to select from any one
            INTO TABLE itab
    FROM prps INNER JOIN proj ON ( prps~pspnr = proj~pspnr  )
    WHERE prps~pspnr IN p_no.
    Best Regards,
    Faisal
    Edited by: Rob Burbank on Dec 24, 2009 12:24 PM

  • Fetch the data from two tables

    hell all
    i want to fetch the data from two tables, one is from internal table and another one is data base table. what syntax i have to use either FOR ALL ENTRIES or INNER JOIN?

    hi
    Use FOR ALL ENTRIES.
    see the sample code
      select * into table tvbrk from vbrk
                                where fkart in ('F2', 'F3', 'RE',
                                           'ZVEC' , 'ZVEM' , 'ZVED',
                                           'S1')
                                and erdat in so_erdat
                                and kunag in s_kunag. 
                                      erdat in so_erdat
                               and   fkart in ('F2', 'F3', 'RE',
                                                 'ZVEC' , 'ZVEM').
    if not tvbrk is initial.
        select * into table t_zregion from zregion
                      for all entries in tvbrk
                       where country = tvbrk-land1
                       and   region = s_regio.
      endif.
    thanks
    sitaram

  • ALV OOps report- getting data from two tables and adding issue

    Hi,
    This is sales employee performance report.
    I need to select all the fields from two tables based on user input ie VKorg, sales employee .
    There is one field callled " Net sales"in both the tables.
    Based on sales employee number, i need to add that net sales which i get from two tables.
    I need to generate single report.
    Can you give some inputs reg. the select query.
    My idea is select all the data from both tables using join statement.
    Thanks

    Hi,
    I have written like this:
    select * from S002 as a join S006 as b
        into table ME->SS002_RAW[]
        where vkorg in me->select_parameters->SO_VKORG[] = vkorg in me->select_parameters->SO_VKORG[]
              and ZZSLSEMP01 in me->select_parameters->SO_so_empl[] = ZZSLSEMP02 in me->select_parameters->SO_so_empl[].
    when i do like that,
    I am getting error
    Incorrect structure of FROM clause . . . .     
    If you give some idea on this
    Edited by: Raja on Apr 22, 2009 11:19 AM

  • How to select data from a table using a date field in the where condition?

    How to select data from a table using a date field in the where condition?
    For eg:
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
                                                      and bdatu = '31129999'.
    thanks.

    Hi Ramesh,
    Specify the date format as YYYYMMDD in where condition.
    Dates are internally stored in SAP as YYYYMMDD only.
    Change your date format in WHERE condition as follows.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and bdatu = <b>'99991231'.</b>
    I doubt check your data base table EQUK on this date for the existince of data.
    Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and <b> bdatu <= '99991231'.</b>
    Thanks,
    Vinay
    Thanks,
    Vinay

  • Cartesian of data from two tables with no matching columns

    Hello,
    I was wondering – what’s the best way to create a Cartesian of data from two tables with no matching columns in such a way, so that there will be only a single SQL query generated?
    I am thinking about something like:
    for $COUNTRY in ns0: COUNTRY ()
    for $PROD in ns1:PROD()
    return <Results>
         <COUNTRY> {fn:data($COUNTRY/COUNTRY_NAME)} </COUNTRY>
         <PROD> {fn:data($PROD/PROD_NAME)} </PROD>
    </Results>
    And the expected result is combination of all COUNTRY_NAMEs with all PROD_NAMEs.
    What I’ve noticed when checking query plan is that DSP will execute two queries to have the results – one for COUNTRY_NAME and another one for PROD_NAME. Which in general results in not the best performance ;-)
    What I’ve noticed also is that when I add something like:
    where COUNTRY_NAME != PROD_NAME
    everything is ok and there is only one query created (it's red in the Query plan, but still it's ok from my pov). Still it looks to me more like a workaround, not a real best approach. I may be wrong though...
    So the question is – what’s the suggested approach for such queries?
    Thanks,
    Leszek
    Edited by xnts at 11/19/2007 10:54 AM

    Which in general results in not the best performanceI disagree. Only for two tables with very few rows, would a single sql statement give better performance.
    Suppose there are 10,000 rows in each table - the cross-product will result in 100 million rows. Sounds like a bad idea. For this reason, DSP will not push a cross-product to a database. It will get the rows from each table in separate sql statements (retrieving only 20,000 rows) and then produce the cross-product itself.
    If you want to execute sql with cross-products, you can create a sql-statement based dataservice. I recommend against doing so.

  • Retreiving data from 2 tables using a sender JDBC Channel

    Hi all,
    We got anew requirement where we have to select data from 2 tables and update fields in 2 tables at the sametime.
    I have a few queries regarding this.
    Can we retrieve data from 2 tables using select query in sender JDBC channel?
    If yes, how we can achieve this?
    Can we use inner/outer joins in the select query?
    Can we update field of 2 tables using the Update query in Sender JDBC channel?
    Your help is greatly rewarded.
    With Regards
    Sudha.

    Hi,
    Even i have the same requirement where data has to be read from 2 tables and later update the falg once done .
    SELECT query :
    SELECT t1.KUNNR,t1.SETT_KEY,t1.QUART_START,t1.QUART_END,t2.PAY_METH,t2.MAT_NDC,t2.AMOUNT   FROM TSAP_REBATE_MEDI t1  INNER JOIN  TSAP_REBATE_LINE t2  ON  t1.KUNNR=t2.KUNNR AND t1.SETT_KEY=t2.SETT_KEY  WHERE  t1.PROCESSING_STATUS = 'N' AND t2.PROCESSING_STATUS = 'N'
    This is working fine.
    Can somebody help me with update query with this. where flag PROCESSING_STATUS has to be updated with 'P'.
    I tried a lot but couldnt get the answer
    Br,
    Manoj

  • Selecting data from two tables

    I am trying to select data from two tables.  The only problem that I am running into, is that i am only seeing results from my 'uploads' table.  there is also a record in documents where user = 1 that should show up.  here is my sql:
    $userIDNum = 1;
    $sql="Select *
    from uploads, documents
    WHERE uploads.user = documents.user AND uploads.user = $userIDNum
    ORDER BY uploads.title ASC, documents.title ASC";

    You'll need to explain a little more about your data and what you are trying to accomplish. Your current sql will select all columns from both the uploads and documents tables but only rows where the user id in both tables match, AND the user id equals 1. Is that not what you are seeing? Where's the code that outputs the results?

Maybe you are looking for

  • ADOBE Interactive Form not getting displayed in Browse

    Hi, Currently I am working on EhP4 project on ECC 6.0 environment. For HCM, We have interactive ADOBE forms for MSS. While testing we found that all buttons are displayed in a browser (we are are window 7 IE 8 ) but interactive form is not getting di

  • Problem Upgrading Photoshop 5.0 to CS1

    I have been using Photoshop Elements 6 for a few years now. Recently, I decided to upgrade to Photoshop CS (yes, the first one). However, I found out I needed a version of Photoshop, not Elements if I wanted to do this. So I purchases Photoshop 5.0 o

  • Keep having to 'Repair Disk permissions'.

    My MBP (2.53 GHZ Intel Core i5, running 10.6.8) keeps running slow, and only improves after Repairing Disk Permissions. I had to run this again this morning - and I'd only ran Permissions repair two days ago! This is what I got; 'Repairing permission

  • My local folders disappeared. How do I get them back?

    Turned computer on. Mozilla asked for email password, for some reason it set up a new account and now my local folders are gone and with them information that I need.

  • Mac Os 9 using 10.4 Open directory

    Hey guys, I am trying to get some of my older mac os 9 computers to see the open directory server, I am using the net boot image that apple gives out for the os 9 net-boot, (It's the apple one) Any help on this? Just Need to get this netboot img to s