Outer join two tables with two keys

Hi,
I have a question regard outer join,
I have table A (Aid, ADesc), Table B(Bid, Bdesc), and Table C (Aid, Bid, Cdesc)
There is data in Table A and B, but Table C is empty
I want to outer join C with A and B with below query
select ADesc,Bdesc, Cdest
from A, B, C
where A.Aid=C.Aid(+) and B.Bid(+)=C.Bid
and A.Aid='XXX' and B.Bid(+)='ZZZ'
The query result show only data in column Adesc , but column BDesc is empty even though there are some data in table B.
How should the query been modified to correctly show ADESC and Bdesc.
Thanks
Vincent

Guess the below should work:
Case when records are available in Table C:
with a as
(select 'XXX' aid, 'adesc' adesc from dual),
b as
(select 'ZZZ' bid, 'bdesc' bdesc from dual),
c as
(select 'XXX' aid, 'ZZZ' bid, 'cdest' cdest from dual where 1 = 1)
select ADesc,Bdesc, C1.Cdest
from
A LEFT OUTER JOIN C c1 ON (A.AID = C1.AID AND A.AID = 'XXX'),
B LEFT OUTER JOIN C C2 ON (B.BID = C2.BID AND B.BID = 'ZZZ');
Output:
"ADESC"     "BDESC"     "CDEST"
"adesc"     "bdesc"     "cdest"Case when table C is empty:
with a as
(select 'XXX' aid, 'adesc' adesc from dual),
b as
(select 'ZZZ' bid, 'bdesc' bdesc from dual),
c as
(select 'XXX' aid, 'ZZZ' bid, 'cdest' cdest from dual where 1 = 2)
select ADesc,Bdesc, C1.Cdest
from
A LEFT OUTER JOIN C c1 ON (A.AID = C1.AID AND A.AID = 'XXX'),
B LEFT OUTER JOIN C C2 ON (B.BID = C2.BID AND B.BID = 'ZZZ');
"ADESC"     "BDESC"     "CDEST"
"adesc"     "bdesc"     ""

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

  • Join fact table with higher dimension level

    how do i join fact tables with higher dimension levels with discoverer?
    fact with detail at level C
    measure X
    dimension with
    D->C->B->A
    E->C
    level
    A B C
    1------1------1
    2------2------1
    3------2------1
    join between fact X and dimension level C
    X=3*C because of sum(X) in discoverer and 3xC in dimension
    is there a way to get correct values for X without creating a dimension like
    D->C
    E->

    another way of asking this is whether you can create a summary table in Discoverer at a higher level than a dimension's fundamental grain. In other words - the summary examples in the documentation all describe leaving out one or more of your dimensions... they are either left in or completely taken out. But, some of the most effective summarization occurs when you summarize daily data to a monthly level. Assuming that I have a sales table (at a daily level, and a key value sales_date), and a table date_dim (primary key sales_date), I would like to create a summary sales_month_summary where the sales are grouped on month_year (which is a field in the sales_date table).
    How is this done? I suspect that we can't use the date_dim table with the summary (due to the problems noted by the poster above). Do we have to create another table "month_dim"? Do we have to fold all of the desired date attributes (month, quarter, year) into the summary? Obviously we'd like to re-use all of the pertinent already existing date items (quarter, month, year, etc.), not recreate them over again, which would result in essentially two sets of items in the EUL. [One used for this month summary, and another used for the detail.]
    I searched the forum - someone asked this same question back in 2000 - there was no answer provided.
    The only other thought I have is to "snowflake" the date_dim into two tables and two folders, one at a date level, another at the month level. Then the detail tables can connect to date_dim (which is linked to month_dim), while the summary data can connect directly to month_dim.

  • How to insert record in child table with foreign key

    Hi,
    I am using Jdeveloper 11.1.2.0. I have two master table one child table.
    How to insert and update a record in child table with foreign key ?
    I have created VO based on three EO(one eo is updatable other two eo are references) by using joined query.
    Thanks in Advance
    Edited by: 890233 on Dec 24, 2011 10:40 PM

    ... And here is the example to insert using sequenceimpl by getting the primary key of the master record and insert master and detail together.
    Re: Unable to insert a new row with a sequence generated column id
    -Arun

  • 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 ;-)

  • 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 2 tables with 2 criteria

    hello
    i'm trying to join 2 tables with 2 criteria
    one criteria is  "numero de matricule" and the other is "date" 
    in one table i have many times the same "matricule"  it depends of "date de validité" validity date
    ex table 1
    n°mat - periode - montant
    1 -31-12-2013 -  100
    table2
    n°mat -periode - nom - adresse
    1 -
    31-12-2013 - gerard  - 12 RUE X
    1- 31/12/2012-GERARD - 2AVENUE Z
    how can i join those tow table
    thak you for your help, i'm a french beginner

    select *
    from table1 as a
    join table2 as b
    on a.n°mat = b.n°mat
    and a.periode = b.periode
    sqldevelop.wordpress.com
    Saeid, check this out and reply there if you're interested:
    http://social.technet.microsoft.com/Forums/en-US/a2e22d61-7c32-43f2-900e-d9d6325fa26d/needed-more-power-pivot-answerers?forum=sqlkjpowerpivotforexcel
    Thank you for all your contributions!
    Ed Price, Azure & Power BI Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • Outer join OJ syntax with JDBC drivers

    Hello,
    I'm facing a problem with CrystalReports 2008 and jdbc connection.
    Crystal genrates OJ syntax (as below) which cannot be interpreted by the Database.
    SELECT "T1"."T1D", "T2"."T2D", "T3"."T3D"
    FROM   {oj ("PUBLIC"."PUBLIC"."T3" "T3" LEFT OUTER JOIN "PUBLIC"."PUBLIC"."T2" "T2" ON "T3"."T2K"="T2"."T2K") LEFT OUTER JOIN "PUBLIC"."PUBLIC"."T1" "T1" ON "T2"."T1K"="T1"."T1K"}
    Prensently my database is HSQLDB.
    After browsing several post about ODBC, I tried to change the registry, introducing a new key
    HKEY_CURRENT_USER\Software\Business Objects\Suite 12.0\Crystal Reports\DatabaseOptions\NoOuterJoinEscSeq=myodbc3,hsqldb
    It did not change anything.
    Now, I suppose Crystal queries the database driver for its capabilities.
    This is done by a DatabaseMetaData object which implements several methods.
    In case of hsqldb, here is what the driver answers:
         public boolean supportsMinimumSQLGrammar() throws SQLException {
              return false;
         public boolean supportsCoreSQLGrammar() throws SQLException {
              return true;
         public boolean supportsExtendedSQLGrammar() throws SQLException {
              return false;
         public boolean supportsANSI92EntryLevelSQL() throws SQLException {
              return false;
         public boolean supportsANSI92IntermediateSQL() throws SQLException {
              return false;
         public boolean supportsANSI92FullSQL() throws SQLException {
              return false;
         public boolean supportsIntegrityEnhancementFacility() throws SQLException {
              return true;
         public boolean supportsOuterJoins() throws SQLException {
              return true;
         public boolean supportsFullOuterJoins() throws SQLException {
              return false;
         public boolean supportsLimitedOuterJoins() throws SQLException {
              return true;
    How can I tell Crystal to stop using the OJ syntax ?
    Thank you and kind regards.
    Alain

    Hi Alaine,
    You are correct, CR does query the driver to get what it requires to use for outer join syntax. The registry key will not work for this driver. It's the driver meta layer telling CR to use the oj syntax and is dependent on the driver being configured.
    Not sure if you can but start by trying to alter these settings if you can:
    public boolean supportsOuterJoins() throws SQLException {
    return true;
    public boolean supportsFullOuterJoins() throws SQLException {
    return false;
    I would think both should be reversed, true to false and false to true.
    Before you do that though go to our download page and install Service Pack 2, it may by a CR issue and the patch may have fixed the problem.
    If it doesn't I suggest asking this on the HSQLDB forum to see how to alter those option. CR follows the JDBC Type 4 Standards. You may want to see if Sun has a HSQLDB JDBC driver also.
    Thank you
    Don

  • Maintenance View for custom table with foreign key relationship

    Hi Folks,
         I have created a custom table with foreign key relationship with other check tables. I want to create a maintenance view / tablemaintenance generator. What all things I need to take care for the foreign keys related fields while creating the maintenance view / tablemaintenance generator.
    Regards,
      santosh

    Hi,
    You do not have to do anything explicitely for the foreign key relationships in the table maintainance generator.
    Create the table maintainance generator via SE11 and it will take care of all teh foreign key checks by itself.
    Regards,
    Ankur Parab

  • Joining a table with all_tab_columns

    How is it possible to join a table with the tab_columns?
    The query im trying to establish is that in my table they are 12 columns with months names. So under an input variable im trying to return the required values with the selected months. The only way i could think of to get the months to connect with the tab_columns table.
    Any suggestion is really appreciated
    SELECT bust,
    Sum(jan) JAN,
    Sum(feb) FEB,
    Sum(mar) MAR,
    Sum(apr) APR,
    Sum(may) MAY,
    Sum(jun) JUN,
    Sum(jul) JUL,
    Sum(aug) AUG,
    Sum(sep) SEP,
    Sum(oct) OCT,
    Sum(nov) NOV,
    Sum(DEC) DECC
    FROM budget a,all_tab_columns b
    WHERE vsl_code = 4602
    AND code = 1
    AND year=2013
    AND account_code='30'
    AND b.table_name='BUDGET'
    AND b.column_name IN
                         (SELECT column_name
                          FROM (SELECT Column_name, ROWNUM r
                                        FROM all_tab_columns b
                                        WHERE table_name = 'BUDGET'
                                        AND Column_id BETWEEN 3 AND 14
                                        ORDER BY column_id)
                          WHERE r BETWEEN 2 AND 3 ) --Returns February,March
    group by bust;

    Sorry, I don't understand what you're trying to do or why you think you need to join to all_tab_columns. Perhaps you could post the definition of the budget table, some sample data, and the results you're hoping to see.
    Without that, I don't see why you can't just do this:
    SELECT bust,   
    Sum(jan) JAN,   
    Sum(feb) FEB,   
    Sum(mar) MAR,   
    Sum(apr) APR,  
    Sum(may) MAY,  
    Sum(jun) JUN,   
    Sum(jul) JUL,   
    Sum(aug) AUG,   
    Sum(sep) SEP,   
    Sum(oct) OCT,  
    Sum(nov) NOV,   
    Sum(DEC) DECC  
    FROM budget a
    WHERE vsl_code = 4602  
    AND code = 1  
    AND year=2013  
    AND account_code='30' 
    group by bust;

  • Join the Table with View

    Hi,
    My doubt is can I join the table with view in the below where clause condition in the query. If yes, the below query will take 4 hrs to execute it. Can I do the below query to write as simplest?
    SELECT *
      FROM uabpymt p, uavlsum l
    WHERE uabpymt_appl_ind = 'N'
       AND uabpymt_amount > 5
       AND l.uavlsum_balance < 0
       AND l.uavlsum_cust_code = p.uabpymt_cust_code
       AND l.uavlsum_prem_code = p.uabpymt_prem_codeuavlsum ---view
    uabpymt ---table
    The view script below:
    CREATE OR REPLACE VIEW UAVLSUM
    (UAVLSUM_CUST_CODE, UAVLSUM_PREM_CODE, UAVLSUM_AMOUNT, UAVLSUM_BALANCE)
    AS
    SELECT cust_code,
           prem_code,
           SUM(amount),
           SUM(balance)
    FROM (
    SELECT uabopen_cust_code cust_code,
           uabopen_prem_code prem_code,
           uabopen_billed_chg amount,
           uabopen_balance balance
    FROM   uimsmgr.uabopen
    UNION ALL
    SELECT uabpymt_cust_code,
           uabpymt_prem_code,
           uabpymt_amount * -1,
           uabpymt_balance * -1
    FROM   uimsmgr.uabpymt
    UNION ALL
    SELECT uabadje_cust_code,
           uabadje_prem_code,
           uabadje_balance,
           to_number(0)
    FROM   uimsmgr.uabadje
    WHERE  uabadje_balance <> 0)
    GROUP BY cust_code,
             prem_code

    Find the below explain plan output which we get from the execute the query
    STATEMENT_ID            TIMESTAMP     REMARKS        OPERATION     OPTIONS          OBJECT_NODE OBJECT_OWNER            OBJECT_NAME            OBJECT_INSTANCE      OBJECT_TYPE OPTIMIZER      
                16/01/2009 05:57:24                   SELECT STATEMENT                                                                                                                           RULE                                                                                                                                                   
                16/01/2009 05:57:24                   FILTER                                                                                                                                                                                                                                    
                16/01/2009 05:57:24                   SORT           GROUP BY                                                                                                                                                                                                                      
                16/01/2009 05:57:24                   TABLE ACCESS           BY INDEX ROWID                     UIMSMGR                     UABPYMT                                1                                             
                16/01/2009 05:57:24                   NESTED LOOPS                                                                                                                                                                                                                                  
                16/01/2009 05:57:24                   VIEW                                                   UIMSMGR                                                         3                                             
                16/01/2009 05:57:24                   UNION-ALL                                                                                                                                                                                                                              
                16/01/2009 05:57:24                   TABLE ACCESS           FULL                            UIMSMGR                     UABOPEN                                    4                                             
                16/01/2009 05:57:24                   TABLE ACCESS           FULL                            UIMSMGR                     UABPYMT                                    5                                             
                16/01/2009 05:57:24                   TABLE ACCESS           FULL                            UIMSMGR                     UABADJE                                    6                                                                                                                                                         
                16/01/2009 05:57:24                   INDEX       RANGE SCAN                                   UIMSMGR                     UABPYMT_CUST_PREM_INDEX                        NON-UNIQUE                                                                                                                           
    Index column:
    Table name :UABPYMT
    Column Name
    UABPYMT_APPL_IND  
    UABPYMT_APPROVED_IND    
    UABPYMT_PYMT_DATE          
    UABPYMT_SOURCE    
    UABPYMT_ORIGIN                   
    UABPYMT_CUST_CODE          
    UABPYMT_PREM_CODE         
    UABPYMT_PYMT_DATE          
    UABPYMT_AR_TRANS             
    UABPYMT_GL_IND                  
    UABPYMT_GL_POST_DATE     
    UABPYMT_AR_TRANS  

  • Join Istore table with AR tables

    Hi Gurus,
    How to join ibe_msites_b table with AR table. I am trying to get list of all customers from different mini sites. These are the AR tables i am using
    HZ_Cust_Accounts
    HZ_Parties
    Regards,

    The following query should give you resullts for B2C. Change the query based on your requirement incase if you want it for B2B. Please note that I haven't added alll the conditions. This should be your starting point.
    Hope this helps,
    RK
    SELECT imt.msite_name,
    hp.party_name
    FROM jtf_um_subscription_reg jusr,
    jtf_um_subscription_resp jure,
    fnd_responsibility fr,
    ibe_msite_resps_b imrb,
    ibe_msites_tl imt,
    fnd_user fu,
    hz_parties hp
    WHERE jusr.subscription_id = jure.subscription_id
    AND jure.responsibility_key = fr.responsibility_key
    AND fr.responsibility_id = imrb.responsibility_id
    AND imrb.msite_id = imt.msite_id
    AND imt.language = USERENV('LANG')
    AND fu.user_id =jusr.user_id
    AND fu.person_party_id = hp.party_id

  • Joining 3 tables with null values

    Hi,
    I have three tables that have varying data in. I want to write a query which will list all three in the result set, but when one of the tables doesn't have a row, write in No Value.
    I will be intending on joining the tables with account numbers. What will be the syntax of a join with three tables where I am not sure which table will have null values?
    Thanks...

    Something like
    select nvl(a.id,'No Value'), nvl(b.id, 'No Value'), nvl(C.id, 'No Value')
       from (select id from t1) a,
                  (select id from t2) b,
                  (select id from t3) c
      where a.id = b.id(+)
          and a.id = c.id(+)
    Hi,
    I have three tables that have varying data in. I want to write a query which will list all three in the result set, but when one of the tables doesn't have a row, write in No Value.
    I will be intending on joining the tables with account numbers. What will be the syntax of a join with three tables where I am not sure which table will have null values?
    Thanks...

  • 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

  • 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             

Maybe you are looking for

  • Internet Explorer immediately launches when try to open the desktop from the Start screen

    When I log onto my computer, instead of the Start screen opening, the Desktop opens, AND when the Desktop opens, Internet Explorer immediately launches there.  Other times, when I log-on, my computer will open on the Start screen, but then immediatel

  • 16:9 Confusion

    Ok, I have scoured the forums and the internet, but I hope you guys can give me a once and for all answer to this. I recently purchased a camcorder (Canon ZR500) which does true (or so camcorderinfo.com says) 16:9. I am not super thrilled with it, bu

  • Mouse events on an image

    Hi everyone, I was wondering whether it is possible to register a MouseMotionListener and a MouseListener object on an Image object to make it respond to mouse clicks Thanks

  • Cisco 5508 Wireless Controller with Splash Page Disclaimer

    How do one configure a splash disclaimer page on a Cisco Wireless Controller 5508 with no authentication? Jimmy

  • R/3 internet sales

    Hi to all, could any one post the document regarding r/3 internet sales [email protected] thanks in advance