Outer Join for 2 Tables?

Hi,
i have 3 Tables, one is the "main" table.
Table1
Col1
Col2
Col3
Table2
Col2
Col4
Col5
Table3
Col4
Col6
Now i want all hits from Table 1, all outer join hits from table 2 and the regarding rows from table 3.
The join from Table1 to Table2 is no problem, but how to add table3?
SELECT *
    FROM table1 AS t1
          LEFT OUTER JOIN table2 AS t2
                ON t2col2 = t1col2
   INTO CORRESPONDING FIELDS OF TABLE      result
    WHERE t1~col1 IN so_col1.

Hi,
a right table in an outer join cannot become a part of an inner join or an outer join. So you will have to use some other technique.
meaing table1 connects to table2 with an outer join resulting in all rows table1 and cooresponding if existing from table2, now table2 is the right table it cannot make a join with table3. inner or outer.
regards,
Khusro Habib

Similar Messages

  • Left outer join 3 tables with where-statement

    Hi folks,
    I hope you can understand (and maybe solve) my problem.
    Generally I try to left outer join three tables. The third table is used for a WHERE-statement.
    The three table structures are the following:
    table 1 (user)   
    user1 | key
    table 2 (detail)  
    key | ID
    table 3 (header)
    ID | user2                 
    ...and I want to achieve the following structure (as example filled with data):
    user | key | ID
    |-----|----
    xy    | a    | 001
    xy    | b    | #
    z     | b     | #
    The clue ist the usage of the third table. I need the table to set user1 and user2 equal (WHERE) but there are two problems:
    1) Obviously I can't left outer join two tables with each other. In this case I already used the 'key' of table 1 to join it with the 'key' of table 2. So I can't left outer join the 'ID' of table 2 with the 'ID' of table 3. Error message that I can only left outer join a table once. Any proposals?
    2) I have to include a WHERE to equal user1 with user2. But I am not allowed to use the user2 from table 3 because of the left outer join.
    I tried this coding:
    SELECT auser1 akey b~id INTO TABLE itab FROM ( table1 AS a
      LEFT OUTER JOIN table2 AS b ON akey = bkey )
      LEFT OUTER JOIN table3 AS c ON bID = cID )
      WHERE auser1 = cuser2.
    I would really appreciate your help.
    Regards
    MrclSpdl

    IF you want to join a DB table with an internal table, you need to use the 'FOR ALL ENTRIES' statement.
    select dbfields
    into table itab2
    from dbtab
    for all entries in itab
    where dbfield1 = itab-field1.
    This will get you a second internal table with all the corresponding data for the first selection.  You can then join them with a loop through the first table and a read table on the second table (for 1 - 1 relation) or a nested loop statement on both tables (for 1 - N relation).  Make itab a hashed table when using read table with key, use a sorted table if you need to loop without key access.
    Regards,
    Freek

  • Best way to outer join a table that is doing a sub query

    RDBMS : 11.1.0.7.0
    Hello,
    What is the best way to outer join a table that is doing a sub query? This is a common scenario in EBS for the date tracked tables.
    SELECT papf.full_name, fu.description
      FROM fnd_user fu
          ,per_all_people_f papf
    WHERE fu.user_id = 1772
       AND fu.employee_id = papf.person_id(+)
       AND papf.effective_start_date = (SELECT MAX( per1.effective_start_date )
                                          FROM per_all_people_f per1
                                         WHERE per1.person_id = papf.person_id)Output:
    No output produced because the outer join cannot be done on the sub queryIn this case I did a query in the FROM clause. Is this my best option?
    SELECT papf.full_name, fu.description
      FROM fnd_user fu
          ,(SELECT full_name, person_id
              FROM per_all_people_f papf
             WHERE papf.effective_start_date = (SELECT MAX( per1.effective_start_date )
                                                  FROM per_all_people_f per1
                                                 WHERE per1.person_id = papf.person_id)) papf
    WHERE fu.user_id = 1772
       AND fu.employee_id = papf.person_id(+)Output:
    FULL_NAME     DESCRIPTION
    {null}            John DoeThanks,
    --Johnnie                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi,
    BrendanP wrote:
    ... See the adjacent thread for the other with Row_Number().Do you mean {message:id=10564772} ? Which threads are adjacent is always changing. Post a link.
    I think RANK suits the requirements better than ROW_NUMBER:
    WITH    all_matches     AS
         SELECT  papf.full_name
         ,      fu.description
         ,     RANK () OVER ( PARTITION BY  papf.person_id
                               ORDER BY          papf.effective_start_date     DESC
                        )           AS r_num
         FROM             fnd_user             fu
         LEFT OUTER JOIN      per_all_people_f  papf  ON  fu.employee_id  = papf.person_id
         WHERE   fu.user_id  = 1772
    SELECT     full_name
    ,     description
    FROM     all_matches
    WHERE     r_num     = 1
    Johnnie: I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    See the forum FAQ {message:id=9360002}

  • Join columns of outer join with table have no uniqueness cons

    Hi! I'm getting noizy error in alert log from time to time:
    Join columns of outer join with table <table_name> have no uniqueness constraints
    I've collected all the queries (v$sql, all_source) with montioned table, but non of them produces that error if executed.
    Any hints how to reproduce this error or where else to search that buggy sql join?
    Edited by: user545083 on 25.10.2010 6:21

    Hi
    I think this error is output via an materialized view refresh - check for mviews against the given table which fulfil the issue given in the error text.
    Thanks
    Paul

  • Create a outer Join for a @SecondaryTable in EJB 3.0

    Hello
    I need to create a outer Join for a @SecondaryTable in EJB 3.0, any can help me?
    Thanks in Advance…

    Yes, I have this relations in the entity:
    @Table(name = "RF_HTRANSACTION")
    @SecondaryTables({
    @SecondaryTable(name="RF_CLIENTS",
    pkJoinColumns={@PrimaryKeyJoinColumn(name="NUMERO_CLIENTE", referencedColumnName="NUMERO_CLIENTE")}
    @SecondaryTable(name="RF_SUPPLIER",
    pkJoinColumns={@PrimaryKeyJoinColumn(name="NUMERO_PROVEEDOR", referencedColumnName="NUMERO_PROVEEDOR")}
    @SecondaryTable(name="RFSUPPLIER_PROY",
    pkJoinColumns={@PrimaryKeyJoinColumn(name="NUMERO_PROYECTO", referencedColumnName="NUMERO_PROYECTO")}
    @SecondaryTable(name="RF_REFAGENTS",
    pkJoinColumns={@PrimaryKeyJoinColumn(name="NUMERO_RA", referencedColumnName="NUMERO_RA")}
    I need to create a outer join between RF_HTRANSACTION and RF_REFAGENTS.

  • Double outer join on table

    Hi
    Let's say I have three tables ORDERS, PRODUCT and CLIENT. I want a query that will give me all PRODUCT and CLIENT combinations and the total sum of orders if it has one. If I try to do this:
    select P.NAME, C.NAME, SUM(O.AMOUNT)
    from PRODUCT P, CLIENT C, ORDER O
    where P.ID = O.PRODUCT_ID(+) and
    C.ID = O.CLIENT_ID(+)
    I get an error where I cannot double outer join a table.
    Any ideas?

    3360 wrote:
    BluShadow wrote:
    and ANSI allows a little more in those terms than regular oracle syntax.It is different, but it cannot do anything that regular equi-joins cannot do. In most cases the optimizer converts ANSI joins to regular joins for execution, and this additional conversion has been subject to numerous bugs.ANSI does allow for doing things that regular Oracle syntax cannot do.
    Here's an ANSI way to do it if you only want to see those client/product combinations that exist in orders table:
    SQL> with product as (
      2     select 101 id, 'Product 1' name from dual union all
      3     select 102 id, 'Product 2' name from dual union all
      4     select 103 id, 'Product 3' name from dual
      5  ), client as (
      6     select 11 id, 'Client 1' name from dual union all
      7     select 12 id, 'Client 2' name from dual
      8  ), orders as (
      9     select 11 client_id, 101 product_id, 10 amount from dual union all
    10     select 11 client_id, 103 product_id, 30 amount from dual union all
    11     select 12 client_id, 102 product_id, 20 amount from dual union all
    12     select 12 client_id, 102 product_id, 20 amount from dual
    13  )
    14  --
    15  -- end-of-test-data
    16  --
    17  select p.name
    18       , c.name
    19       , sum(o.amount)
    20    from orders o
    21    left outer join product p
    22         on p.id = o.product_id
    23    left outer join client c
    24         on c.id = o.client_id
    25   group by
    26         p.name
    27       , c.name
    28   order by
    29         p.name
    30       , c.name
    31  /
    NAME      NAME     SUM(O.AMOUNT)
    Product 1 Client 1            10
    Product 2 Client 2            40
    Product 3 Client 1            30(If the datamodel is good with product_id being a foreign key of product.id and the same with client, then outer join is not really necessary, I know. But for the sake of argument assume bad datamodel that needs outer join ;-) )
    The above ANSI can be written in regular Oracle syntax as well:
    SQL> with product as (
      2     select 101 id, 'Product 1' name from dual union all
      3     select 102 id, 'Product 2' name from dual union all
      4     select 103 id, 'Product 3' name from dual
      5  ), client as (
      6     select 11 id, 'Client 1' name from dual union all
      7     select 12 id, 'Client 2' name from dual
      8  ), orders as (
      9     select 11 client_id, 101 product_id, 10 amount from dual union all
    10     select 11 client_id, 103 product_id, 30 amount from dual union all
    11     select 12 client_id, 102 product_id, 20 amount from dual union all
    12     select 12 client_id, 102 product_id, 20 amount from dual
    13  )
    14  --
    15  -- end-of-test-data
    16  --
    17  select p.name
    18       , c.name
    19       , sum(o.amount)
    20    from orders o, product p, client c
    21   where p.id(+) = o.product_id
    22     and c.id(+) = o.client_id
    23   group by
    24         p.name
    25       , c.name
    26   order by
    27         p.name
    28       , c.name
    29  /
    NAME      NAME     SUM(O.AMOUNT)
    Product 1 Client 1            10
    Product 2 Client 2            40
    Product 3 Client 1            30Many old Oracle coders will probably state that this syntax is much easier. For a simple case like this I find both ways easy. But I have complex cases where I much prefer ANSI where I can easily distinguish join predicates from filter predicates. It is a matter of opinion, I know ;-)
    But if we then take the original post as a literal specification, that we want all combinations of products and clients and then the sum of order amount if it exists, null otherwise.
    This can be written easily in ANSI notation:
    SQL> with product as (
      2     select 101 id, 'Product 1' name from dual union all
      3     select 102 id, 'Product 2' name from dual union all
      4     select 103 id, 'Product 3' name from dual
      5  ), client as (
      6     select 11 id, 'Client 1' name from dual union all
      7     select 12 id, 'Client 2' name from dual
      8  ), orders as (
      9     select 11 client_id, 101 product_id, 10 amount from dual union all
    10     select 11 client_id, 103 product_id, 30 amount from dual union all
    11     select 12 client_id, 102 product_id, 20 amount from dual union all
    12     select 12 client_id, 102 product_id, 20 amount from dual
    13  )
    14  --
    15  -- end-of-test-data
    16  --
    17  select p.name
    18       , c.name
    19       , sum(o.amount)
    20    from product p
    21   cross join client c
    22    left outer join orders o
    23         on o.product_id = p.id
    24        and o.client_id = c.id
    25   group by
    26         p.name
    27       , c.name
    28   order by
    29         p.name
    30       , c.name
    31  /
    NAME      NAME     SUM(O.AMOUNT)
    Product 1 Client 1            10
    Product 1 Client 2
    Product 2 Client 1
    Product 2 Client 2            40
    Product 3 Client 1            30
    Product 3 Client 2
    6 rows selected.ANSI notation allows outer join with more than one table.
    Regular Oracle syntax could only do this by creating an inline view of the cartesian join and then outer joining orders with the inline view. Doable, but not as nice (IMHO) as the ANSI method for a case like this ;-)

  • Handling Outer Join for hard coded values in the Logical Table Source

    Has anyone tried to apply an outer join in the Logical Table Source Content Tab?
    I have to add this APPLSYS.FND_LOOKUP_VALUES.LANGUAGE (+)= 'US' but the outer join is not allowed. I get this message.... [nQSError: 27002] Near <(>: Syntax error [nQSError: 26012] .
    Could you tell me please how this should be handled? I have a lot of this cases in my project and without this being set-up affects the expected output of my report.
    Thank you in advance.

    hi Ap,
    Pull only Dim_W_LOV_D_Acty_Src column into answers and check whether u r able to see CUST_SRC_ACT or not .Of course, you need to check sql query too
    Thanks,
    Saichand.v

  • LEFT OUTER JOIN multiple tables - using the 9i syntax

    I've always written my queries using the (+) operator for outer joins. I want to start using the new ANSI standard available in 9i. I can do it when I'm joining two tables in a simple query, but how does it work when I am joining multiple tables?
    Here is an example of some SQL that works with the (+) outer join syntax. How can I convert this to use the LEFT OUTER JOIN syntax?
    SELECT *
    FROM audit_entry aue,
    audit_table aut,
    audit_statement aus,
    audit_row aur,
    audit_row_pkey aup1,
    audit_row_pkey aup2
    WHERE aue.audit_entry_id = aus.audit_entry_id
    AND aut.table_name = 'TEST_AUDITING'
    AND aut.table_owner = 'CLA_JOURNAL'
    AND aus.audit_table_id = aut.audit_table_id
    AND aur.audit_statement_id (+) = aus.audit_statement_id
    AND aup1.audit_row_id (+) = aur.audit_row_id
    AND aup1.pk_column_name (+) = 'TEST_AUDTING_PK_1'
    AND aup2.audit_row_id (+) = aur.audit_row_id
    AND aup2.pk_column_name (+) = 'TEST_AUDITING_PK_2'
    I can join audit_statement to audit_entry easy enough, but then I want to join audit_table to audit_statement, how do I do that, do I start nesting the join statements?
    Thanks
    Richard

    Thanks for getting back so quickly, I have tried the suggested SQL with mixed results:
    SELECT COUNT(*)
    FROM audit_entry aue
    JOIN audit_statement aus ON aue.audit_entry_id = aus.audit_entry_id
    JOIN audit_table aut ON aus.audit_table_id = aut.audit_table_id
    RIGHT OUTER JOIN audit_row aur ON aur.audit_statement_id = aus.audit_statement_id
    RIGHT OUTER JOIN audit_row_pkey aup1 ON aup1.audit_row_id = aur.audit_row_id
    RIGHT OUTER JOIN audit_row_pkey aup2 ON aup2.audit_row_id = aur.audit_row_id
    WHERE aut.table_name = 'TEST_AUDITING_TWO'
    AND aut.table_owner = 'CLA_JOURNAL'
    AND aup1.pk_column_name = 'TEST_AUDTING_PK_1'
    AND aup2.pk_column_name = 'TEST_AUDITING_PK_2'
    I had to change the order slightly, between the first two JOINs but otherwise it executed OK. My problem is, it should only return 175 rows but its returning 30625 rows. If I comment out the second reference to audit_row_pkey I get the expected result:
    SELECT COUNT(*)
    FROM audit_entry aue
    JOIN audit_statement aus ON aue.audit_entry_id = aus.audit_entry_id
    JOIN audit_table aut ON aus.audit_table_id = aut.audit_table_id
    RIGHT OUTER JOIN audit_row aur ON aur.audit_statement_id = aus.audit_statement_id
    RIGHT OUTER JOIN audit_row_pkey aup1 ON aup1.audit_row_id = aur.audit_row_id
    --RIGHT OUTER JOIN audit_row_pkey aup2 ON aup2.audit_row_id = aur.audit_row_id
    WHERE aut.table_name = 'TEST_AUDITING_TWO'
    AND aut.table_owner = 'CLA_JOURNAL'
    AND aup1.pk_column_name = 'TEST_AUDTING_PK_1'
    --AND aup2.pk_column_name = 'TEST_AUDITING_PK_2'
    It looks the same condition is being used in each case but why do I suddenly get so many rows - its joining differently somehow. It must be to do with the order, do I need to bracket the query?
    Thanks again
    Richard

  • Left Outer Joining multiple tables to one source table FAILS with VLD-1511

    Hi all,
    Is it me, or is OWB unable to handle left outer joining 1 source table to multiple other tables?
    I want to load a fact table so I have 1 source table with measures. This table must be outer joined to some dimensions that have their FK in the fact table.
    The SQL statement would look like this (and is perfectly valid):
    select ...
    from input, dim1, dim2
    where input.c1 = dim1.c1(+)
    and input.c2 = dim2.c2(+);
    I put the where clause in the joiner operator and validate, but that gives me message VLD-1511: A table may be outer joined to at most one other table.
    Even splitting this up into one outer join per joiner still gives this message.
    A search and look around on the forum and on metalink shows there are related issues (like bug 3334035). Seemingly creating a view is the work-around to use.....? (ie downgrading owb to a simple gui tool) }-;
    Have other people experienced this problem of not being able to outer join one input table to multiple other tables?
    Thanks,
    Ed

    I have had some feedback from Oracle. It turns out this has to do with 2 issues. Below I have pasted the text that Support gave me:
    <---------- START QUOTE ---------->
    RESEARCH
    =========
    Bug 3437036 KEY LOOKUP DOES NOT DETECT ORA-1417 IN VALIDATE/GENERATE STEP
    Unpublished Bug 4211684 FORWARD PORT OF BUG 3437036
    shows:
    Some more development has been completed when this bug is fixed in Paris.
    The following are the details:
    1. If the join condition contains a full outer join such as
    tab1.c (+) = tab2.c (+) and tab2.c (+) = tab3.c
    then the new validations implemented for this bug do not apply since
    in OWB, full outer join triggers generation of joins in ANSI syntax.
    ANSI syntax does not have the original problem the base bug of this
    bug reported.
    2. If the join condition does not contain any full outer join condition,
    then the join is generated in Oracle join syntax, which is subject two
    several restrictions. The fix to this bug check two of the restrictions.
    3. The first restriction in Oracle syntax is that the outer join operator
    "(+)" can only directly be attached to a column name. If you attach it
    to an expression, such as the following:
    (tab1.c + 1) (+) = tab2.c
    Then there will be an ORA-936 error at the time of mapping deployment.
    For this case, I have added a validation message VLD-1512 to error out
    this situation.
    4. The second restriction in Oracle syntax is that a table can only be
    outer joined to exactly one other table.
    For example, this is an invalid join in Oracle syntax:
    tab1.c (+) = tab2.c and tab1.d (+) = tab3.d
    because tab1 is left outer joined to tab2 and tab3.
    But note that the following is still valid in Oracle syntax:
    tab1.c (+) = tab2.c and tab1.d = tab3.d (+)
    because tab1 is left outer joined to tab2 and right outer joined to tab3.
    So this latter case does not violate the restriction that "same oj" to
    more than 1 table is not allowed.
    If same oj to more than 1 table is specified in a join condition,
    VLD-1511 will be issued, and the map is made invalid.
    <---------- END QUOTE ---------->
    OWB does a partial validation, ie not all access paths are (can be) checked. A full check is only done by the database itself. So some scenarios (like checking whether multiple tables are outer joined the correct way) are not checked, and in this case are flagged with an error (even though it is actually a correct scenario).
    Seemingly this was not flagged with an error in earlier versions of OWB, so beware, OWB behaviour may change when upgrading...
    Alternative solutions are (1) using key lookups, (2) using a view with all outer joins in there, (3) using intermediate result tables between the joins.
    Hope this info helps some people prevent spending too much time on a false error message,
    Ed

  • Outer join two tables with query search record attached to both tables

    When I create a query with two tables that have query search records attached with outer join, PS seems to do a natural join (cartesian). We are on PT8.48.
    Is there a workaround for this issue. I do not want to remove query search record on either of the tables.
    I am trying to create an Emergency contact report. I am using two tables PS_EMPLOYEES and PS_EMERGENCY_CNTCT. Here is the sql PeopleSoft query generated when I did Left outer Join.
    Query SQL:
    SELECT A.EMPLID, A.NAME, A.ADDRESS1, A.CITY, B.PRIMARY_CONTACT, B.ADDRESS1, B.CITY, B.STATE, B.POSTAL, B.RELATIONSHIP, A.DEPTID, A.JOBCODE, A.COMPANY, A.EMPL_TYPE
    FROM (PS_EMPLOYEES A LEFT OUTER JOIN PS_EMERGENCY_CNTCT B ON A.EMPLID = B.EMPLID ), PS_EMPLMT_SRCH_QRY A1, PS_PERS_SRCH_QRY B1
    WHERE A.EMPLID = A1.EMPLID
    AND A.EMPL_RCD = A1.EMPL_RCD
    AND A1.OPRID = 'SREESR'
    AND (B.EMPLID = B1.EMPLID OR B.EMPLID IS NULL )
    AND B1.OPRID = 'PS'
    Appreciate any help.

    I think there are fixes for this issue in later tools releases (Report ID 1544345000). I'm not sure about 8.48, but you might try the workaround documented in
    E-QR: Left Outer Joins with Security Records are returning unexpected results [ID 651252.1]
    on Oracle Support.
    Regards,
    Bob

  • How to find Inner join or (Left)outer join for Infoset

    Dear Experts,
    We have one Infoset which is based on the Master data and DSO. It is linked 0BPARTNER field From the Master Data and SOLD TO PARTY field from the DSO.
    Here Could you please suggest me how can we able to find that whether this Infoset is based on Inner Join or (Left) outer join.
    Thanks and Regards,
    Suresh.

    HI Suresh,
    If the infoset is based on left outer join , you see the respective table shaded in a dirrerent colour and also displays
    that it is a left outer join in the connection
    refer the below link for the details on left outer join , you can make a join as left outer from the context menu of the
    object required
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/21/af0942b9dc9c39e10000000a155106/frameset.htm
    Regards,
    Sathya

  • Outer Join Two tables

    I got two Tables.APPROVAL_ROUTING_TAB and doc_issue_tab where APPROVAL_ROUTING_TAB has more rows. I need to do the join two tables such that All the rows in APPROVAL_ROUTING_TAB should be displayed ( more rows) but still connect with the doc_issue_tab. I did an outer join syntax failed.
    What is the correct syntax for this.
    Key_ref takes the following pattern "DOC_CLASS=PR_CLASS_1^DOC_NO=1000007^DOC_REV=A3^DOC_SHEET=1^"
    SELECT
    ar.line_no LINE_NO,
    ar.step_no STEP_NO,
    ar.lu_name LU_NAME,
    ar.key_ref KEY_REF,
    ar.description DESCRIPTION,
    di.status STATUS
    FROM APPROVAL_ROUTING_TAB ar, doc_issue_tab di
    WHERE
    ar.key_ref = 'DOC_CLASS='||di.doc_class||'^DOC_NO='||di.doc_no||'^DOC_REV='||di.doc_rev||'^DOC_SHEET='||di.doc_sheet||'^') (+)
    Thansk in advance
    Prash

    Other options include:
    with t1 as (select 1 id, 'd1=fred^d2=john^d3=bob^' col2 from dual union all
                select 1 id, 'd1=fred^d2=john^d3=george' col2 from dual),
         t2 as (select 'fred' d1, 'john' d2, 'bob' d3 from dual union all
                select 'jim' d1, 'john' d2, 'bob' d3 from dual)
    select *
    from   t1, (select t2.*, 'd1='||d1||'^d2='||d2||'^d3='||d3||'^' full_col
                from t2) t3
    where  t1.col2 = t3.full_col (+);
            ID COL2                      D1   D2   D3  FULL_COL              
             1 d1=fred^d2=john^d3=bob^   fred john bob d1=fred^d2=john^d3=bob^
             1 d1=fred^d2=john^d3=george                                     
    with t1 as (select 1 id, 'd1=fred^d2=john^d3=bob^' col2 from dual union all
                select 1 id, 'd1=fred^d2=john^d3=george' col2 from dual),
         t2 as (select 'fred' d1, 'john' d2, 'bob' d3 from dual union all
                select 'jim' d1, 'john' d2, 'bob' d3 from dual)
    select *
    from   t1 left outer join t2 on (t1.col2 = 'd1='||d1||'^d2='||d2||'^d3='||d3||'^');
            ID COL2                      D1   D2   D3
             1 d1=fred^d2=john^d3=bob^   fred john bob
             1 d1=fred^d2=john^d3=george             

  • Outer join for a database view

    Dear Experts,
    Could you tell me what is the outer join and the example of this?
    Is it possible I can create an outer join view for generic extraction?
    Thanks.
    Arthur

    This is what a nested loops would look like in ABAP.  It is not a function module, but it could be made into one very easily.
    REPORT zz_temp.
    DATA: l_t_tstc    TYPE TABLE OF tstc,
          l_t_tstct   TYPE TABLE OF tstct,
          l_s_tstc    TYPE tstc,
          l_s_tstct   TYPE tstct.
    SELECT *
    INTO CORRESPONDING FIELDS OF l_s_tstc
    FROM tstc AS t.
      SELECT tt~ttext
      INTO CORRESPONDING FIELDS OF l_s_tstct
        FROM tstct AS tt
        WHERE tt~tcode = l_s_tstc-tcode
        AND tt~sprsl = sy-langu.
      ENDSELECT.
      WRITE:/ l_s_tstc-tcode,l_s_tstct-ttext.
    ENDSELECT.

  • Alternative for OUTER Join for use in fast refresh materialized view

    Hi ,
    I have two tables as :
    CREATE TABLE TEST_SANDY1
    COL1 NUMBER
    CREATE TABLE TEST_SANDY2
    COL1 NUMBER,
    COL2 VARCHAR2(10 BYTE)
    Data for the tables are :
    INSERT INTO TEST_SANDY1 ( COL1 ) VALUES (
    1);
    INSERT INTO TEST_SANDY1 ( COL1 ) VALUES (
    2);
    INSERT INTO TEST_SANDY1 ( COL1 ) VALUES (
    3);
    COMMIT;
    INSERT INTO TEST_SANDY2 ( COL1, COL2 ) VALUES (
    1, 'a');
    INSERT INTO TEST_SANDY2 ( COL1, COL2 ) VALUES (
    2, 'b');
    INSERT INTO TEST_SANDY2 ( COL1, COL2 ) VALUES (
    4, 'd');
    COMMIT;
    Now when I run the following select statement :
    select
    b.col1
    from
    test_sandy1 a,
    test_sandy2 b
    where
    b.COL1 = a.COL1(+)
    I get :
    COL1
    1
    2
    4
    I want to build a materialized view to generate the same values but it has to be fast refresh. But since I am using outer join I am unable to create a fast refresh one.
    Can someone suggest an alternate select to create fast refresh materialized view.
    Thanks,
    Sandipan

    The select statement was not fitting my problem , so I'll change it as :
    select
    a.col1, nvl(b.col2, 'DEFAULT')
    from
    test_sandy1 a,
    test_sandy2 b
    where
    b.COL1(+) = a.COL1
    I get :
    COL1     VAL
    1     a
    2     b
    3     DEFAULT
    How do I this ?

  • Unable to collapse rows after full outer joining several tables

    All -
    I often do a "full outer join" on numerous tables when I want to report all of the
    contents of all of the tables in one relatively easy to inspect set of output. However,
    now that my "leading" table is missing certain values, my output is definitely not
    what I want.
    Here's a test case:
    drop table test11;
    create table test11 (x number);
    insert into test11 values (1);
    insert into test11 values (3);
    drop table test12;
    create table test12 (x number);
    insert into test12 values (2);
    insert into test12 values (3);
    drop table test13;
    create table test13 (x number);
    insert into test13 values (1);
    insert into test13 values (2);
    drop table test14;
    create table test14 (x number);
    insert into test14 values (2);
    commit;
    select test11.x t11,
    test12.x t12,
    test13.x t13,
    test14.x t14
    from (((test11 full outer join test12 on test11.x = test12.x)
    full outer join test13 on test11.x = test13.x)
    full outer join test14 on test11.x = test14.x);
    And here is the output:
    T11 T12 T13 T14
    1 1
    3 3
    2
    2
    2
    5 rows selected.
    Forgive me if this doesn't appear with a fixed-width font. I
    don't know how to format these postings.
    See rows 3, 4, and 5? My desire is to jam those
    together so that my output is this instead:
    T11 T12 T13 T14
    1 1
    3 3
    2 2 2
    3 rows selected.
    Do you have any idea how to do this? Of course, I'll need to
    apply the solution to the general case so that all
    test cases similar to this are fixed!
    Thanks very much for your time!
    Tom G.

    For anyone who's interested -
    Here is the solution I was able to put together on my own:
    select max(t11) t11, max(t12) t12, max(t13) t13, max(t14) t14 from
    select coalesce(test11.x, test12.x, test13.x, test14.x) ct,
           test11.x    t11,
           test12.x    t12,
           test13.x    t13,
           test14.x    t14
      from (((test11 full outer join test12 on test11.x = test12.x)
                    full outer join test13 on test11.x = test13.x)
                    full outer join test14 on test11.x = test14.x))
    group by ct;And the output:
           T11        T12        T13        T14
                        2          2          2
             1                     1
             3          3
    3 rows selected.Bye,
    Tom G.

Maybe you are looking for

  • Difference between Pgi and Invoice verification

    good receipt=100 invoice verfication=110 how u can find out price differences

  • User Exit not getting triggered

    Dear all, we are creating a workflow for PR Release which needed release strategy customization. so we are trying to set the release stratagy by changing the communciation structure CEBAN-USRC1 field. for this, i had done the following things: 1. SMO

  • Mxml components not compiled into swc?

    Hi, I am using Flash Builder(Flex 4) and i am having issues compiling mxml components into swc. My scenario: I created Flex Library project, added some mxml components and actionsript classes. I created separate Flex project and added swc file to pro

  • Problem in Payslip Layout format

    Hi All, Our payslip format in ESS have been changed automatically.  Half of of the page on right side of the Payslip have been truncated. the following are changes I found on the payslip 1. Font Size of the Payslip became larger 2. Layout of the pays

  • Drop down list selection problem

    Hi there, We're having trouble selecting an item from a drop down list. The list in question fires javascript that resets the list to an index of 0 on the mouseover event (this cannot be changed for testing). When the open script is recorded it appea