Right outer join

There are four tables:

Family
Parent
Child
Grandchild

Ideally, they have all documents, such as

F1 - P1 - C1 - G1
F2 - P2 - C2 - G2
F3 - P3 - C3 - G3

But sometimes,.

F1 - P1 - C1 - null
F2 - P2 - null - null
F3 - P3 - null - null

For the case of the latter, maybe I need to right outer join. If it's between two tables, the right outer join is easier. But among the four tables, inner family join parent, child of the outer join, then the big kid outer join. Maybe even this has been done? If an outer join in this case is not relevant, what other options are available?


Thank you

(ORACLE 11.2)

Hello

As Salomon, said

FROM  p  LEFT  OUTER JOIN c

means exactly the same thing that

FROM  c  RIGHT OUTER JOIN p

Everything you do with LEFT OUTER JOIN you could also do with RIGHT OUTER JOIN, and vice versa. If either one did not exist, you may do whatever you want with the other. In practice, it's just what's happening: most of the people always use LEFT OUTER JOIN and never use a RIGHT OUTER JOIN.

You can have a series of outer joins cascading. If I understand your problem, a particular family may or may not have parents that belongs to him. If there are relatives, then you want to show the family with his parents to realteaed, but if there are no parents, so you want to show the family anyway. Similarly, you want to show parents whether or not they have children, and the children or not all my grandchildren are related to them. In general, which is written like this:

...
FROM           family          f
LEFT OUTER JOIN      parent          p    ON  p.family_id  = f.family_id
LEFT OUTER JOIN      child          c    ON  c.parent_id  = p.parent_id
LEFT OUTER JOIN      grandchild  g       ON  g.child_id   = c.child_id

You can have a situation where (for example) a child is related to a family, but the child has no parent? In this case, you can still use LEFT OUTER JOIN, but join conditions would be different.

Tags: Database

Similar Questions

  • left and right outer join

    Hi gurus,

    Left outer join:

    -------------------

    Select * from A LEFT OUTER JOIN B on A.col = B.col;

    by definition, a left outer join brings the rows that match the join condition and lines not corresponding to table A.

    My question here is "corresponding to B and no matching rows in A" is that nothing, but... SELECT * FROM A;

    can someone pls clarity...

    Thank you.

    Imagine that you had:

    TableA

    COLUMN1 COLUMN2

    'A'                1

    'B'                2

    'C'                3

    TABLEB

    COLUMN1 COLUMN2

    'A'                 'X1'

    'A'                 'X2'

    'B'                 'Y'

    'D'                 'Z'

    SELECT * FROM TABLEA;

    A 1

    B 2

    C 3

    Now, if you want to join (first column is either in table A or B, (deuxieme from tableA, third table B)

    SELECT * FROM TABLEA A JOIN TABLEB B ON (A.COLUMN1 = B.COLUMN1)

    A 1 X 1

    A 1 X 2

    B 2 Y

    SELECT * FROM TABLE LEFT B EXTERNAL ON (A.COLUMN1 = B.COLUMN1) JOIN TABLE

    A 1 X 1

    A 1 X 2

    B 2 Y

    C 3 {null}

    SELECT * FROM TABLE A TABLE RIGHT OUTER JOIN B (A.COLUMN1 = B.COLUMN1)

    A 1 X 1

    A 1 X 2

    B 2 Y

    D {null} Z

    SELECT * FROM TABLE A TABLE FULL OUTER JOIN B (A.COLUMN1 = B.COLUMN1)

    A 1 X 1

    A 1 X 2

    B 2 Y

    C 3 {null}

    D {null} Z

    HTH

  • He had to know the right outer join using...

    He had to know the right outer join using...

    For example: first query left outer join for the emp table: SELECT EMPNO, ENAME, D.DEPTNO FROM EMP E, Department D WHERE the E.DEPTNO = D.DEPTNO)

    Second query left outer join for the Dept table: SELECT EMPNO, ENAME, D.DEPTNO FROM EMP E, Department D WHERE the D.DEPTNO = E.DEPTNO)

    In the example above I just Exchange where condition condition to get an outer join of two table with a left outer join itself. Wat is use right outer join, instead, I can swap the status of table name for the result. Please suggest...

    Hello

    chan001 wrote:

    He had to know the right outer join using...

    For example: first query left outer join for the emp table: SELECT EMPNO, ENAME, D.DEPTNO FROM EMP E, Department D WHERE the E.DEPTNO = D.DEPTNO)

    Second query left outer join for the Dept table: SELECT EMPNO, ENAME, D.DEPTNO FROM EMP E, Department D WHERE the D.DEPTNO = E.DEPTNO)

    In the example above I just Exchange where condition condition to get an outer join of two table with a left outer join itself. Wat is use right outer join, instead, I can swap the status of table name for the result. Please suggest...

    The two examples above use the old syntax outer join of Oracle. (I guess there should be a sign inside the parentheses, e.g.. +)

    ...  WHERE E.DEPTNO = D.DEPTNO (+)

    )

    The LEFT OUTER JOIN and RIGHT OUTER JOIN terms apply only to the ANSI join syntax, e. g.

    .

    .. FROM EMP E

    DEPT LEFT OUTER JOIN D ON E.DEPTNO = D.DEPTNO

    As Blushadow said above, there's no real point in having LEFT OUTER JOIN and RIGHT OUTER JOIN;  What you can do with one (or a combination of both) can be done with the other.  Most people use LEFT OUTER JOIN systematically and never use RIGHT OUTER JOIN.

    There are situations where using a combination of the two would mean a little less striking, but only a little less and this kind of situation is very common, and one may wonder if the somewhat shorter code is more specific.  I suggest that forget you RIGHT OUTER JOIN.

  • Reg: Diff between Right Join and Right Outer Join

    Dear all,

    Kindly help me to find the difference between the two queries below where the results are the same.

    SELECT * FROM emp RIGHT JOIN dept WE emp.deptno = dept.deptno;


    SELECT * FROM emp RIGHT OUTER JOIN dept WE emp.deptno = dept.deptno;

    Thank you

    Both are same

  • Looking for right outer join help

    Hello

    Can anyone help me re - write the query using right below outer join (join ansi) instead of using the (+) symbol.

    Select cd.sku_id waitm,

    Decode (cl.invn_lock_code, NULL, 'OH', cl.invn_lock_code) WLOCN,

    Sum (CD.actl_qty) WQOH

    cd, a.case_lock cl, a.case_hdr ch, a.item_master im a.case_dtl

    where cd.case_nbr = ch.case_nbr

    and cl.case_nbr (+) = ch.case_nbr

    and cd.sku_id = im.sku_id

    and ch.stat_code < = '64'

    Cd.sku_id group,

    IM.sku_brcd,

    Decode (cl.invn_lock_code, NULL, 'OH', cl.invn_lock_code)

    order of cd.sku_id

    Kind regards

    Gannu

    Maybe something like this:

    of a.case_dtl cd

    Join a.case_hdr ch on (cd.case_nbr = ch.case_nbr)

    Join a.item_master im on (cd.sku_id = im.sku_id)

    join a.case_lock cl left (cl.case_nbr = ch.case_nbr)

    where ch.stat_code<=>

    I know you asked for right outer join, but I tend to write like that.  You can certainly change if you wish.

  • Difference between Inner join and right outer join...

    Which is precisely the difference between an Inner join and right outer join...

    JOIN INTERNAL:-to return all rows from the two tables where there is a football game. That is to say. the table resulting from all the rows and columns will have values.

    AND

    RIGHT OUTER JOIN:-Returns all rows in the second table, even if there is no match in the first table.

  • Full table on the right outer join scan

    Hello, I need help. Here's my query-

    SELECT / * + first_rows (100) * /.
    a.custom_gr_id, a.custom_gr_name AS customgroupname,
    a.custom_gr_type_id AS customtypeid, b.workspace_id, b.NAME, a.itime,
    a.is_shared_org AS est_partagee
    OF custom_group_pa one
    RIGHT OUTER JOIN
    account_workspace_pa b ON (a.workspace_id = b.workspace_id
    AND (a.delete_flag IS NULL or a.delete_flag <>1)
    AND a.owner_id = '123')
    WHERE b.workspace_id <>- 9999
    AND b.workspace_type_id = 1
    AND b.delete_flag = 0
    AND EXISTS (SELECT 1
    Of account_workspace_type c
    WHERE b.workspace_type_id = c.workspace_type_id)
    ITime to ORDER BY DESC;

    Account_workspace_pa almost 1 500 483 lines and custom_group_pa had 200 000 lines and account_workspace_type is a very small table of 10 lines.

    I always get a full on table account_workspace_pa table scan, while I have clues about workspace_id AND I index on workspace_id, workspace_type_id and delete_flag. The request is expected to produce less than 500 lines.

    Here's the plan I make-

    Plan
    COUNCIL of the SELECT STATEMENT: FIRST_ROWSCost: 3 931 bytes: 405 108 cardinality: 7 502
    8 SORTING ORDER BY ORDER BY a.ITIME DESCCost: 3 931 bytes: 405 108 cardinality: 7 502
    7 LOOPS IMBRIQUEES EXTERNAL (ACCOUNT_WORKSPACE_TYPE at ACCOUNT_WORKSPACE_PA) in CUSTOM_GROUP_PACost: 3 930 bytes: 405 108 cardinality: 7 502
    3 LOOPS IMBRIQUEES ACCOUNT_WORKSPACE_TYPE to ACCOUNT_WORKSPACE_PACost: 2 280 bytes: 210 056 cardinality: 7 502
    1 INDEX UNIQUE INDEX (SINGLE) ADR_DEV SCAN. SYS_C0025442 aliased as cCost: cardinality of 0 bytes: 6: 1
    TABLE 2 ACCESS FULL TABLE ADR_DEV. ACCOUNT_WORKSPACE_PA alias ADR_DEV_DATA Tablespaceb.WORKSPACE_ID b! = - 9999, b.WORKSPACE_TYPE_ID = 1 b.DELETE_FLAG = 0Cost: 2 280 bytes: 165 044 cardinality: 7 502
    VIEW 6 (Embedded SQL) cost: 0 bytes: 26 cardinality: 1
    TABLE 5 ACCESS BY INDEX ROWID TABLE ADR_DEV. Aliased as one on ADR_DEV_DATA TablespaceCost CUSTOM_GROUP_PA: 04:00 cardinality: 1
    4 INDEX RANGE SCAN INDEX ADR_DEV. IDX_CG_WSID_DF_OWID aliased as aa.delete_flag (+) is NULL, a.delete_flag (+)! = 1, a.owner_id (+) = '123', a.workspace_id (+) = b.workspace_idCost: cardinality 3: 1


    If someone can advise, why I always make a full table scan on table account_workspace_pa and what I can do to have a systematic index scan?

    Thank you.

    If you need all the lines then that would be a clue do for you?

    You don't necessarily need a full table scan. But if you have need of all ranks, it is certainly more effective to do a full scan (read through all of the blocks table in bulk, once) rather than navigate throu an index and jump from block to block to block (probably one at a time, probably having to hit most of them more than once until the work is done) after the ROWID as they occur in the index.

    Also, fully entered null will not appear in the index, so (depending on your data, NOT NULL constraints, etc.) it may be possible that navigate through an index will cause lines to be ignored.

    I think you look at that and see a problem, but the answer is: it's really the best way to accomplish what you're asking.

  • Outer join does not not as expected left

    Hi all

    I have it here are three tables with values. Mentioned the under outer join query does not and behave like the inner query.

    CREATE TABLE RET_FUND_FEE

    (

    NPTF VARCHAR2 (8 CHAR),

    TPART VARCHAR2 (4 CHAR)

    );

    CREATE TABLE PART_PTF

    (

    Mf_Id VARCHAR2 (6 CHAR) NOT NULL,

    TPARTS VARCHAR2 (4 CHAR) NOT NULL

    );

    CREATE TABLE TFC_FUNDS

    (

    NPTF VARCHAR2 (8 CHAR) NOT NULL,

    MULTIFONDS_ID VARCHAR2 (6 CHAR)

    );

    INSERT INTO RET_FUND_FEE VALUES('111','A');

    INSERT INTO RET_FUND_FEE VALUES('111','D');

    INSERT INTO RET_FUND_FEE VALUES('111','E');

    INSERT INTO PART_PTF VALUES ('MF1', 'A');

    INSERT INTO PART_PTF VALUES ('MF1', 'B');

    INSERT INTO PART_PTF VALUES('MF1','C');

    INSERT INTO TFC_FUNDS VALUES('111','MF1');

    INSERT INTO TFC_FUNDS VALUES('111','MF1');

    INSERT INTO TFC_FUNDS VALUES('111','MF1');

    SELECT A.TPART, B.TPARTS, A.NPTF, B.Mf_Id, C.MULTIFONDS_ID, C.NPTF

    OF RET_FUND_FEE A, PART_PTF B, TFC_FUNDS C

    WHERE A.NPTF = C.NPTF

    AND C.MULTIFONDS_ID = B.Mf_Id

    AND A.TPART = B.TPARTS (+)

    AND C.MULTIFONDS_ID = 'MF1 '.

    AND C.NPTF = '111'

    Here, I expect all records in the RET_FUND_FEE table that I am using outer join.

    But I'm only corresponding chronogram RET_FUND_FEE, PART_PTF as an inner join. Can you get it someone please let me know what lack us.

    Is my version of oracle 11g

    SELECT

    A.TPART, B.TPARTS, A.NPTF, B.Mf_Id, C.MULTIFONDS_ID, C.NPTF

    Of

    PART_PTF B

    Join

    C TFC_FUNDS

    on (C.MULTIFONDS_ID = B.Mf_Id

    AND C.MULTIFONDS_ID = 'MF1 '.

    AND C.NPTF = '111'

    )

    right outer join

    RET_FUND_FEE HAS

    on (A.TPART = B.TPARTS

    and A.NPTF = C.NPTF) - added as correction

    TPART TPARTS NPTF MF_ID MULTIFONDS_ID NPTF
    A A 111 MF1 MF1 111
    A A 111 MF1 MF1 111
    A A 111 MF1 MF1 111
    E - 111 - - -
    D - 111 - - -

    or

    SELECT A.TPART, d.TPARTS, A.NPTF, d.Mf_Id, d.MULTIFONDS_ID, d.NPTF

    OF RET_FUND_FEE HAS

    , (

    Select

    *

    PART_PTF b, TFC_FUNDS C

    where B.Mf_Id = C.MULTIFONDS_ID

    AND C.MULTIFONDS_ID = 'MF1 '.

    AND C.NPTF = '111'

    ) d

    WHERE A.TPART = D.TPARTS (+)

    and A.NPTF = D.NPTF (+) - added as a correction

    Sorry had to correct the syntax oracle solution.

    The first one was bad because it would return also B lines that have no match in C.

    Sorry a correction more on these two approaches, missed the second predicate.

  • How to manage the update/insert in display with Outer Join object?

    Hello

    I have a problem in the treatment of update/insert in the original Version that contains two EOs with right outer join. The first EO values are inserted before and I want if second values EO already exists, it will update and if not a new record created.

    Error when I commit after entering values is: ' entity line with null key is not found in SecondEO. "

    What is the solution?

    Thank you

    Hello

    Make sure that your view object, you have included the key attributes of the two entity objects.

    Kind regards

    Saif Khan.

  • Outer joins and null in the 'where' clause condition

    Hi people,

    Please help me on this.

    Here's my query.

    with x

    (select 'a' as a dual union all col1)

    Select 'b' as col1 of union double all the

    Select 'c' as double col1

    ),

    y as

    (

    Select 'b' as col2 from dual Union all the

    Select 'c' as col2 from dual Union all the

    Select would be "as col2 from dual Union all the"

    Select 'e' as col2 from dual

    )

    Select * x y right outer join

    on x.col1 = y.col2 and y.col2 is null

    Get all the lines of 'COL1' as null. Why like this?

    Just add the condition to the WHERE clause for example

    WITH x AS
    (SELECT 'a' AS col1 FROM dual UNION ALL
    SELECT 'b' AS col1 FROM dual UNION ALL
    SELECT 'c' AS col1 FROM dual
    ),
    y AS
    (
    SELECT 'b' AS col2 FROM dual UNION ALL
    SELECT 'c' AS col2 FROM dual UNION ALL
    SELECT 'd' AS col2 FROM dual UNION ALL
    SELECT 'e' AS col2 FROM dual
    )
    SELECT * FROM x LEFT OUTER JOIN y
    ON x.col1=y.col2                     ----want to add "and y.col2 is null " condition to get value "a"
    where y.col2 is null
    
  • Left Outer Join help...

    Hello world

    I'm still trying to learn the SQL, and I can not specifically with the left outer join.  I normally join tables using equijoin, but I don't get the right data set returns, and designed with the help of a left or right outer join would solve the problem...

    Here is my SQL that works properly with 1 left outer join.  I build the slow query in the SQL following, you will see where I see the error.  I don't expect you to understand the data and the columns, I'm trying to join, I think the problems I encounter are related to syntax, and I hope that you can find where are my syntax errors.

    Select

    s.Name as "Pseudonym,"

    SV.view_name as "name of the view.

    s_view. Name

    Of

    s s_screen,

    s_screen_view sv

    outer join left s_view

    WE (sv.view_name = s_view.name)

    where

    SV.screen_id = ' 1-866 A - 1X3LU' and

    s.ROW_ID = sv.screen_id and

    s.repository_id = ' 866 A-1-1"and

    s_view.repository_id = ' A-1-1 866 ";

    Here is the SQL code where I encounter the following error...

    Error:

    ORA-00904: "SV". "" View_name ": invalid identifier

    00904, 00000 - '% s: invalid identifier '.

    * Cause:

    * Action:

    Error on line: column 14: 7

    Problematic SQL:

    Select

    s.Name as "Pseudonym,"

    SV.view_name as "name of the view.

    s_view. Name,

    s_applet. Name as Applet

    -b.SID like "name of the cmdlet.

    Of

    s s_screen,

    s_screen_view sv,

    wti s_view_wtmpl_it

    outer join left s_view

    WE (sv.view_name = s_view.name)

    outer join left s_applet

    WE (wti.name = s_applet.name)

    where

    SV.screen_id = ' 1-866 A - 1X3LU' and

    s.ROW_ID = sv.screen_id and

    s.repository_id = ' 866 A-1-1"and

    s_view.repository_id = ' A-1-1 866 ";

    Thanks in advance for your help.

    Chris

    > ORA-00904: "S_VIEW_WEB_TMPL." "" ROW_ID ": invalid identifier

    I don't see this table in your FROM clause.

  • My Confusion of outer join

    Oracle 10g

    I have three below queries that use the outer join syntax.

    All three queries return exactly the same results


    (a)
    SELECT TA.ID TA
         , TB.ID TB
      FROM TA
         , TB
     WHERE TA.ID = TB.ID(+);
    (b)
    SELECT TA.ID TA
         , TB.ID TB
      FROM TA
         , TB
     WHERE TB.ID(+) = TA.ID;
    (c)
    SELECT TA.ID TA
         , TB.ID TB
      FROM TA
      LEFT OUTER JOIN TB ON TA.ID = TB.ID;
    I have the right call outer join query because the (+) sign is located on the right and outer join query (b) left because the (+) sign is on the left?

    Or is the left join or right determined by the join columns specified in the order select it?



    Create the Script
    CREATE TABLE TA
      (
        "ID" NUMBER
      );
    
    CREATE TABLE TB
      (
        "ID" NUMBER
      );
    
    INSERT INTO TA (ID) VALUES ('1');
    INSERT INTO TA (ID) VALUES ('2');
    INSERT INTO TA (ID) VALUES ('3');
    
    INSERT INTO TB (ID) VALUES ('1');
    INSERT INTO TB (ID) VALUES ('2');
    INSERT INTO TB (ID) VALUES ('4');
    Ben

    Published by: benton on August 15, 2012 08:16

    Hi, Ben.

    Benton says:
    ... So is it correct to say that the left or right refers to which side the null values will be displayed?

    Lol it is incorrect to say that the old syntax outer join (using the sign +) is either a left - or a right outer join.

    ... So I need to have the order of the columns in the correct SELECTION so that there is no likelihood of confusion over which side will display NULL values. If I place the columns A and B in the wrong order, that is to say B then a I'll lend to confusion about what will be returned with respect whether left or right.

    No, do not hesitate to organize columns in the select in any way will help your users the most. What is happening in the FROM and WHERE clause, in particular the order in which the tables happens to appear, may not have something to do with the order of the columns in the output.
    Many readers are more comfotable with having NULL columns at the end of a line of output, or at least not at the beginning, so maybe it's one of the reasons for ta.id first in your example. Rearrange the columns in the game any way more than makes sense for people who will look at them.

  • Outer join issues

    Hi guys,.

    I use Oracle 10 G database. When I run the query below, I am of course a mistake given that an outer join more then one table:
    ---------------------
    SELECT
      MV_VAA_INC_MONTHLY_SUMMARY.Month_ID,
      MV_VAA_INC_MONTHLY_SUMMARY.PRIORITY,
      sum(MV_VAA_INC_MONTHLY_SUMMARY.CLOSED),
      decode(MV_VAA_INC_MONTHLY_SUMMARY.SLA_MET, 1, 0, 1),
      MV_VAA_INC_MONTHLY_SUMMARY.INCIDENT_NUMBER,
      to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'Mon')||' '||to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'yy'),
      INC_BREACH_SLA_DETAILS.RESPONSIBILITY
    FROM
      MV_VAA_INC_MONTHLY_SUMMARY , HPD_HELP_DESK,
       INC_BREACH_SLA_DETAILS,
       MIS_QUEUES_RESP  INC_MIS_QUEUES_RESP  
    WHERE
      (
       ( INC_MIS_QUEUES_RESP.RESP = ANY ('TCS', 'NONTCS')  )
       AND
       ( ( MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH ) BETWEEN ( add_months(trunc(sysdate,'MM'), -4) ) AND ( trunc(sysdate,'MM') -1 )  )
       AND
       MV_VAA_INC_MONTHLY_SUMMARY.Month_ID = 201110
       AND
       MV_VAA_INC_MONTHLY_SUMMARY.INCIDENT_NUMBER (+) = HPD_HELP_DESK.INCIDENT_NUMBER
       AND
       INC_BREACH_SLA_DETAILS.INCIDENT_NUMBER=HPD_HELP_DESK.INCIDENT_NUMBER (+)
       AND 
       INC_MIS_QUEUES_RESP.SUPPORT_GROUP_ID=HPD_HELP_DESK.ASSIGNED_GROUP_ID (+)
      )
    GROUP BY
      MV_VAA_INC_MONTHLY_SUMMARY.Month_ID, 
      MV_VAA_INC_MONTHLY_SUMMARY.PRIORITY, 
      decode(MV_VAA_INC_MONTHLY_SUMMARY.SLA_MET, 1, 0, 1), 
      MV_VAA_INC_MONTHLY_SUMMARY.INCIDENT_NUMBER, 
      to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'Mon')||' '||to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'yy'), 
      INC_BREACH_SLA_DETAILS.RESPONSIBILITY
    HAVING
      sum(MV_VAA_INC_MONTHLY_SUMMARY.CLOSED)  =  1
    ---------------------

    But when I run the sub query quite similar, I do not receive an error.

    -------------------------
    SELECT
      MV_VAA_INC_MONTHLY_SUMMARY.Month_ID,
      MV_VAA_INC_MONTHLY_SUMMARY.PRIORITY,
      sum(MV_VAA_INC_MONTHLY_SUMMARY.CLOSED),
      decode(MV_VAA_INC_MONTHLY_SUMMARY.SLA_MET, 1, 0, 1),
      MV_VAA_INC_MONTHLY_SUMMARY.INCIDENT_NUMBER,
      to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'Mon')||' '||to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'yy'),
      INC_BREACH_SLA_DETAILS.RESPONSIBILITY
    FROM
      MV_VAA_INC_MONTHLY_SUMMARY RIGHT OUTER JOIN HPD_HELP_DESK ON (MV_VAA_INC_MONTHLY_SUMMARY.INCIDENT_NUMBER=HPD_HELP_DESK.INCIDENT_NUMBER)
       LEFT OUTER JOIN INC_BREACH_SLA_DETAILS ON (INC_BREACH_SLA_DETAILS.INCIDENT_NUMBER=HPD_HELP_DESK.INCIDENT_NUMBER)
       LEFT OUTER JOIN MIS_QUEUES_RESP  INC_MIS_QUEUES_RESP ON (INC_MIS_QUEUES_RESP.SUPPORT_GROUP_ID=HPD_HELP_DESK.ASSIGNED_GROUP_ID)  
    WHERE
      (
       ( INC_MIS_QUEUES_RESP.RESP = ANY ('TCS', 'NONTCS')  )
       AND
       ( ( MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH ) BETWEEN ( add_months(trunc(sysdate,'MM'), -4) ) AND ( trunc(sysdate,'MM') -1 )  )
       AND
       INC_BREACH_SLA_DETAILS.RESPONSIBILITY  NOT IN  ( 'NONE'  )
       AND 
       MV_VAA_INC_MONTHLY_SUMMARY.Month_ID = 201110
      )
    GROUP BY
      MV_VAA_INC_MONTHLY_SUMMARY.Month_ID, 
      MV_VAA_INC_MONTHLY_SUMMARY.PRIORITY, 
      decode(MV_VAA_INC_MONTHLY_SUMMARY.SLA_MET, 1, 0, 1), 
      MV_VAA_INC_MONTHLY_SUMMARY.INCIDENT_NUMBER, 
      to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'Mon')||' '||to_char(MV_VAA_INC_MONTHLY_SUMMARY.FIRST_DAY_OF_THE_MONTH, 'yy'), 
      INC_BREACH_SLA_DETAILS.RESPONSIBILITY
    HAVING
      sum(MV_VAA_INC_MONTHLY_SUMMARY.CLOSED)  =  1
    -------------------------

    Please can you advise the reason.

    See you soon,.
    Khadi

    Published by: BluShadow on November 11, 2011 10:54
    addition of {noformat}
    {noformat} tags. Please read {message:id=9360002} and learn to do this yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Hi, yaya,

    888121 wrote:
    Hi guys,.

    In fact I'm not guru in Oracle as such. The first query, I pasted works well.

    You mean the second query (one with ANSI joins) is running fine and the first query (with signs +) is a mistake, right?

    Looking at this request I created the joins in the second, but then I get this error. I just want to understand what is the difference in the ANSI query and mine is throwing this error.

    Join ANSI rating supports outer joins to more than one table; the old syntax doesn't work. That's all there is to it. The ANSI syntax also supports FULL OUTER JOIN, and the old syntax does not work. There is nothing wrong with more than one table outer join, just as there is nothing wrong with a full outer join. You can do it with the old syntax, but just more coding.

    Published by: Frank Kulash, November 11, 2011 08:16

  • using (+) or left outer join

    Dear Expert;

    I've been playing by using the two symbol... and realized that they do the same thing... Is it true...? or am I wrong.

    Thank you.

    Hello

    user13328581 wrote:
    Dear Expert;

    I've been playing by using the two symbol... and realized that they do the same thing... Is it true...? or am I wrong.

    They all have two outer joins. The + rating was the original way to do it in Oracle. LEFT, RIGHT, and FULL OUTER JOIN introduced in Oracle 9, but the old way is still supported.

    There are some situations (such as an outer join complete and outer-join a table to two different tables) that are better with the ANSI syntax (it's LEFT OUTER JOIN). It is possible to get the same results using +, but it must be combersome and/or inefficient workarounds. I suggest that you use always LEFT OUTER JOIN (or FULL OUTER JOIN, or, on occasions RIGHT OUTER JOIN). I think that you will find it easier and less error-prone.

  • OUTER JOIN query returns the results of JOIN IN-HOUSE 11.2.0.1.0

    I'm data transfer in 11.2.01.0 (Windows XP 32-bit) and I wanted to compare the sizes of table with the same Table name in two different patterns, ML and SILENT, with a FULL OUTER JOIN (to account for all the tables and NULL values in a diagram).

    The scheme of ML has 176 tables: schema TUT a 133 tables. The use of a standard INNER JOIN gives 131 paintings.

    I get precisely the results with a FULL OUTER JOIN I get with an INTERNAL JOIN (not the same NULL values so I know they exist).

    This happens in SQL-Plus, SQL_Developer and using Oracle Wire pilot of Data_Direct.

    Here is the code:

    Login: SYS as SYSDBA or SYSTEM (same results for either)

    SELECT M.TABLE_NAME, M.NUM_ROWS, T.TABLE_NAME, T.NUM_ROWS
    OF SYS. ALL_TABLES M FULL OUTER JOIN SYS. ALL_TABLES T ON M.TABLE_NAME = T.TABLE_NAME
    WHERE
    M.OWNER = 'ML' AND
    T.OWNER = 'TUT';

    Produce the same results with LEFT OUTER joins and RIGHT OUTER joins in ASI and Oracle (+) syntax.

    Any thoughts?

    Hello

    If you read what I posted, forget it. MScallion (below) gave the correct answerr.

    If conditions such as

    owner   = 'ML'
    

    in the WHERE clause, and then they will reject the rows of the result set formed by the join condition.

    The inner join returns only 131 lines where the two 'paintings' have the same table_names.
    The outer joins return multiple lines (133, 176 or 178) before the place WHERE the provision is applied , but the WHERE clause eliminates all lines except the 131 found by the inner join.

    Published by: Frank Kulash, July 10, 2010 14:23

Maybe you are looking for