Outer joins for multiple columns

I have a data model that is simple, consisting of two dimension tables and one fact table. The fact table contains two columns of dimension and the column of a fact.

The dimensions are time and channel (from a Global schema). The dimension in the fact table columns are months and the track, which are the lowest in their respective dimensions. The column is for sale.

Not all combinations of time and channel data available, because our data goes back to 1998, but we don't sell through the Internet channel until 2001.

A simple request for monthly responses, channels, and sales returns just what you would expect - only the lines that actually have data in the fact table.

I would like to see all THE combinations of month and channel, regardless of whether or not there is a line in the fact table. I was under the impression that the definition of the join would type Left Outer in the complex join in the model diagram of Business happening. I did, as well affecting the Left Outer relations. The resulting SQL code looks like this:

Select T68. MONTHS in the c1 form,
T50. CHANNEL C2,
sum (T514. Turnover) in c3,.
T68. MONTH_END_DATE as c4
Of
T68 BI_D_TIME left (outer join
Left outer join BI_D_CHANNEL T50
BI_F_SALES T514 on T50. CHANNEL = T514. CHANNEL) on T68. MONTH = T514. MONTH
Group of T50. CHANNEL, T68. MONTHS, T68. MONTH_END_DATE
order of c4, c2

Unfortunately, that SQL is not what I want it to do. It returns the same results as above - namely, only the lines that exist in the fact table. I confirmed that by running the code in SQL Developer. It returns one row for each month, but it returns a line for each combination of months and channel.

For example, in Jan98, I get a line for the channel catalog, but not for the Internet or directly. Dec05, I get a line with Dec05 as month, NULL as the canal and of course NULL as sales. What I'd like TO see for each month is three lines, each line containing one of the three values of channel, if this month/channel combination had no sale or not.

Is it possible to change the repository to accomplish what I want to do?

Check here how you can make densification on an environment of ROLAP
http://gerardnico.com/wiki/dat/OBIEE/bi_server/design/obiee_densification

See you soon
Nico

Tags: Business Intelligence

Similar Questions

  • Calculate totals for multiple columns

    I want to add totals for the two columns in a table and a total end with these two subtotals. I can not know how to do this and how to reference the rows and cells. Can someone please? Thank you. Deepa

    Add Totals to multiple columns.jpg

    Give a name for each line of the footer... (For ex: FotterRow1, FooterRow2)...

    Then your code will work without a lot of complications.

    Sum (FooterRow1.TotalA1 + FooterRow2.TotalA2)

    Thank you

    Srini

  • Partition outer join

    Hello

    I want a report that shows data for all combinations of dimensions, although in fact no data exists for them.

    http://download.Oracle.com/docs/CD/E11882_01/server.112/e10578/tdpdw_sql.htm#TDPDW0072
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    Here's my data model, inventory with a status as 'sold out' or 'available' and the designer of the element
    DROP TABLE inventory
    /
    DROP TABLE inv_status
    /
    DROP TABLE designer
    /
    CREATE TABLE inv_status(
         id          NUMBER  PRIMARY KEY
        ,description VARCHAR2(12)
        )
    /
    CREATE TABLE designer(
         id          NUMBER  PRIMARY KEY
        ,name        VARCHAR2(12)
        )
    /
    CREATE TABLE inventory(
         id          NUMBER  PRIMARY KEY
        ,fk_ist      NUMBER
            CONSTRAINT fk_inv_status
            REFERENCES inv_status (id)
        ,fk_des      NUMBER
            CONSTRAINT fk_designer
            REFERENCES designer (id)
        ,name        VARCHAR2(20)
        ,description VARCHAR2(12)
        )
    /
    and some examples of data
    INSERT INTO inv_status (id,description) VALUES (25,'sold out');
    INSERT INTO inv_status (id,description) VALUES (26,'available');
    INSERT INTO inv_status (id,description) VALUES (27,'comming soon');
    INSERT INTO inv_status (id,description) VALUES (28,'not in use');
    
    INSERT INTO designer (id,name) VALUES (111,'Marco');
    INSERT INTO designer (id,name) VALUES (112,'Tommy');
    INSERT INTO designer (id,name) VALUES (113,'Daisy');
    INSERT INTO designer (id,name) VALUES (114,'Laura');
    
    INSERT INTO inventory (id,fk_ist,fk_des,name,description) VALUES (1,25,112,'moon boot','k');
    INSERT INTO inventory (id,fk_ist,fk_des,name,description) VALUES (2,25,113,'high heel','r');
    INSERT INTO inventory (id,fk_ist,fk_des,name,description) VALUES (3,26,114,'sandal','f');
    INSERT INTO inventory (id,fk_ist,fk_des,name,description) VALUES (4,26,113,'flip-flop','u');
    INSERT INTO inventory (id,fk_ist,fk_des,name,description) VALUES (5,27,112,'horseshoe','j');
    INSERT INTO inventory (id,fk_ist,fk_des,name,description) VALUES (6,27,114,'magic pair of boots','o');
    INSERT INTO inventory (id,fk_ist,fk_des,name,description) VALUES (7,27,113,'runner','r');
    INSERT INTO inventory (id,fk_ist,fk_des,name,description) VALUES (8,27,112,'loafer',NULL);
    INSERT INTO inventory (id,fk_ist,fk_des,name,description) VALUES (9,27,113,'climbing spur',NULL);
    COMMIT;
    I need a simple outer join to find each status as well as the objects (if available)
    SELECT  ist.id ist
           ,inv.id
           ,inv.name
           ,ist.description
    FROM    inv_status ist
            LEFT JOIN inventory inv
              ON (ist.id = inv.fk_ist)
    ORDER BY ist.id, inv.id;
    /*
    IST ID  NAME                 DESCRIPTION
    --- --- -------------------- ------------
    25  1   moon boot            sold out
    25  2   high heel            sold out
    26  3   sandal               available
    26  4   flip-flop            available
    27  5   horseshoe            comming soon
    27  6   magic pair of boots  comming soon
    27  7   runner               comming soon
    27  8   loafer               comming soon
    27  9   climbing spur        comming soon
    28                           not in use
    
    10 rows selected
    */
    The same I get with a left join partition
    SELECT  ist.id ist
           ,inv.id
           ,inv.name
           ,ist.description
    FROM    inv_status ist
            PARTITION BY (ist.id)
            LEFT JOIN inventory inv
              ON (ist.id = inv.fk_ist)
    ORDER BY ist.id, inv.id;
    /*
    IST ID  NAME                 DESCRIPTION
    --- --- -------------------- ------------
    25  1   moon boot            sold out
    25  2   high heel            sold out
    26  3   sandal               available
    26  4   flip-flop            available
    27  5   horseshoe            comming soon
    27  6   magic pair of boots  comming soon
    27  7   runner               comming soon
    27  8   loafer               comming soon
    27  9   climbing spur        comming soon
    28                           not in use
    
    10 rows selected
    */
    But what is the right partition join? Why do I have multiple lines for each State where no items exist? Or in other words: someone can tell me what I asked of the DB and it makes sense to ask him: -?
    SELECT  ist.id ist
           ,inv.id
           ,inv.name
           ,ist.description
    FROM    inventory inv
            PARTITION BY (inv.fk_ist)
            RIGHT JOIN inv_status ist
              ON (ist.id = inv.fk_ist)
    ORDER BY ist.id, inv.id;
    /*
    IST ID  NAME                 DESCRIPTION
    --- --- -------------------- ------------
    25  1   moon boot            sold out
    25  2   high heel            sold out
    25                           sold out
    25                           sold out
    26  3   sandal               available
    26  4   flip-flop            available
    26                           available
    26                           available
    27  5   horseshoe            comming soon
    27  6   magic pair of boots  comming soon
    27  7   runner               comming soon
    27  8   loafer               comming soon
    27  9   climbing spur        comming soon
    27                           comming soon
    27                           comming soon
    28                           not in use
    28                           not in use
    28                           not in use
    
    18 rows selected
    */
    For any combination of x as well as objects Designer item (if available) again a simple Cartesian product is easy to do.
    SELECT  ist.id ist
           ,des.id des
           ,inv.id
           ,inv.name
           ,ist.description
           ,des.name designer
    FROM    inv_status ist
            CROSS JOIN designer des
            LEFT JOIN inventory inv
              ON (ist.id = inv.fk_ist
                 AND des.id = inv.fk_des
                 )
    ORDER BY ist.id,des.id,inv.id;
    /*
    IST DES ID  NAME                 DESCRIPTION  DESIGNER
    --- --- --- -------------------- ------------ ------------
    25  111                          sold out     Marco
    25  112 1   moon boot            sold out     Tommy
    25  113 2   high heel            sold out     Daisy
    25  114                          sold out     Laura
    26  111                          available    Marco
    26  112                          available    Tommy
    26  113 4   flip-flop            available    Daisy
    26  114 3   sandal               available    Laura
    27  111                          comming soon Marco
    27  112 5   horseshoe            comming soon Tommy
    27  112 8   loafer               comming soon Tommy
    27  113 7   runner               comming soon Daisy
    27  113 9   climbing spur        comming soon Daisy
    27  114 6   magic pair of boots  comming soon Laura
    28  111                          not in use   Marco
    28  112                          not in use   Tommy
    28  113                          not in use   Daisy
    28  114                          not in use   Laura
    
    18 rows selected
    */
    But I just can't get with the join of LEFT or RIGHT partition
    SELECT  inv_ist.ist
           ,des.id des
           ,inv_ist.id
           ,inv_ist.name
           ,inv_ist.description
           ,des.name designer
    FROM    designer des
            PARTITION BY (des.id)
            LEFT JOIN (
                SELECT  ist.id ist
                       ,inv.fk_des
                       ,inv.id
                       ,inv.name
                       ,ist.description
                FROM    inv_status ist
                        PARTITION BY (ist.id)
                        LEFT JOIN inventory inv
                          ON (ist.id = inv.fk_ist)
                ) inv_ist
            ON (des.id = inv_ist.fk_des
               OR inv_ist.fk_des IS NULL)
    ORDER BY inv_ist.ist,des.id,inv_ist.id;
    /*
    IST DES ID  NAME                 DESCRIPTION  DESIGNER
    --- --- --- -------------------- ------------ ------------
    25  112 1   moon boot            sold out     Tommy
    25  113 2   high heel            sold out     Daisy
    26  113 4   flip-flop            available    Daisy
    26  114 3   sandal               available    Laura
    27  112 5   horseshoe            comming soon Tommy
    27  112 8   loafer               comming soon Tommy
    27  113 7   runner               comming soon Daisy
    27  113 9   climbing spur        comming soon Daisy
    27  114 6   magic pair of boots  comming soon Laura
    28  111                          not in use   Marco
    28  112                          not in use   Tommy
    28  113                          not in use   Daisy
    28  114                          not in use   Laura
    
    13 rows selected
    */
    SELECT  inv_ist.ist
           ,des.id des
           ,inv_ist.id
           ,inv_ist.name
           ,inv_ist.description
           ,des.name designer
    FROM    (
            SELECT  ist.id ist
                   ,inv.fk_des
                   ,inv.id
                   ,inv.name
                   ,ist.description
            FROM    inventory inv
                    PARTITION BY (inv.fk_ist)
                    RIGHT JOIN inv_status ist
                      ON (ist.id = inv.fk_ist)
            ) inv_ist
            PARTITION BY (inv_ist.fk_des)
            RIGHT JOIN designer des
              ON (des.id = inv_ist.fk_des)
    ORDER BY inv_ist.ist,des.id,inv_ist.id;
    /*
    IST DES ID  NAME                 DESCRIPTION  DESIGNER
    --- --- --- -------------------- ------------ ------------
    25  112 1   moon boot            sold out     Tommy
    25  113 2   high heel            sold out     Daisy
    26  113 4   flip-flop            available    Daisy
    26  114 3   sandal               available    Laura
    27  112 5   horseshoe            comming soon Tommy
    27  112 8   loafer               comming soon Tommy
    27  113 7   runner               comming soon Daisy
    27  113 9   climbing spur        comming soon Daisy
    27  114 6   magic pair of boots  comming soon Laura
        111                                       Marco
        111                                       Marco
        111                                       Marco
        111                                       Marco
        112                                       Tommy
        112                                       Tommy
        112                                       Tommy
        113                                       Daisy
        113                                       Daisy
        113                                       Daisy
        114                                       Laura
        114                                       Laura
        114                                       Laura
    
    22 rows selected
    */
    Does anyone know a simple description, something like 'Partition of outer join for Dummies

    Concerning
    Marcus

    Edited by: Marwim the 28.12.2010 09:11
    Typo

    Hey, Marcus,

    Marwim wrote:
    And that's exactly my problem: what kind of problems can I solve with outer joins partitioned?

    Programming would be much easier (and therefore less interesting and less well-paid) if it has nice, short answers to these questions.

    According to my experience, cross joins are the best when you dimension tables and partitioned outer joins are good when you don't.
    Cionsider the following partitioned outer join, which shows all the possible combinations of the job and the Department:

    SELECT       d.dname
    ,       e.deptno
    ,       e.job
    ,       e.ename
    FROM          scott.dept     d
    LEFT OUTER JOIN     scott.emp     e     PARTITION BY (e.job)
              ON     d.deptno     = e.deptno
    ORDER BY  d.deptno
    ,       e.job
    ;
    

    Output:

    DNAME              DEPTNO JOB       ENAME
    -------------- ---------- --------- ---------
    ACCOUNTING                ANALYST
    ACCOUNTING             10 CLERK     MILLER
    ACCOUNTING             10 MANAGER   CLARK
    ACCOUNTING             10 PRESIDENT KING
    ACCOUNTING                SALESMAN
    ...
    OPERATIONS                ANALYST
    OPERATIONS                CLERK
    OPERATIONS                MANAGER
    OPERATIONS                PRESIDENT
    OPERATIONS                SALESMAN
    

    It's a great use of a partitioned outer join, because there is no dimension table for employment (that is, there is no table with one line per job, which may be the target of a key foregin reference). You can use a join Cross (more an external koin) to get the same results, but it would be a subquery such as

    WITH  all_jobs  AS
    (
        SELECT DISTINCT  job
        FROM           scott.emp
    ) ...
    

    to create a table dimesnion to the fly.

    There may be exceptions. For example, if you don't have a table, but there are some jobs that actually occur in the emp table, and you want the output to include only the jobs that exist in the emp table, then the easiest thing is just to ignore the jobs table and do the partitioned outer join illustrated above.

  • 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

  • Outer join on the Filter Condition

    Hello

    I would like to show all rows in a query for two conditions to filter on the 'status '. I used an outer join on the outer query to return the values inside the inline query, but it returns not to return all rows.

    create table (test)
    ID number,
    start_date date,
    status varchar2 (1).
    number of amount,
    number of cust_type
    );


    Insert test values (001, June 1, 2014 ", am ', 189, 78");
    Insert test values (001, March 26, 2014 ", 'R', 175, 4");
    Insert test values (001, December 1, 2014 ", 'R', 89, 91");
    Insert test values ("001, 13 August 2014 ', 'J', 19, 2);
    Insert test values (001, 12 August 2014 ', 'E', 19, 2);

    Insert test values (002, January 1, 2014 ', 'R', 17, 4);
    Insert test values (002, 26 June 2014 ", 'R', 175, 4");
    Insert test values (' 002, February 1, 2014 ', 'J', 9, 8);
    Insert test values (002, 13 October 2014 ', ', 190, 2);

    Insert test values (' 003, June 1, 2014 ', 'J', 189, 78);
    Insert test values (003, March 26, 2014 ", 'R', 175, 4");
    Insert test values (003, December 1, 2014 ", 'R', 89, 91");
    Insert test values (' 003, 13 August 2014 ', 'J', 19, 2);
    Insert test values (' 003, 12 August 2014 ', 'J', 19, 2);

    commit;

    Select i.ids, i.start_date, i.cust_type, i.amount as gross_amount, i.amount + ii.amount as net_amount
    test I have,
    (select id, amount)
    of the test
    where (status = status or 'R' = 'J')) ii
    where i.cust_type in (4, 78, 91, 2, 4, 8)
    and i.ids (+) = ii.ids
    and i.status (+) to (', 'E')
    "and i.start_date between 1 January 14 ' and 31-dec-2014."

    The query above exclude ID 003 because there is that no status (M / E) butI want always display all codes, even if the condition is not consistent

    Hello

    Want results from an inner join to match identifiers, but the results of an outer join for identifiers that are not?  In other words, you want to include the rows of the table I only when one of the following is true:

    The line of table I have ticked all the boxes, or

    No line in not table i with the same ID meets all conditions

    ?

    If so, here's a way to do it:

    WITH got_rnk AS

    (

    Select i.ids, i.start_date, i.cust_type

    , nvl2 (ii.ids, i.amount, 0) as gross_amount

    , i.amount + nvl (ii.amount, 0) as net_amount

    dense_rank () over (partition of i.ids

    order of nvl2 (ii.ids, 'A', 'B')

    ) as rnk

    I have test

    (in left outer join

    SELECT ID, amount

    of the test

    where status ('R', 'J')

    ) ii on i.ids = ii.ids

    and i.cust_type in (4, 78, 91, 2, 4, 8)

    and i.start_date between to_date (January 1, 2014 ", 'dd-mon-yyyy')

    and to_date (31-dec-2014', 'dd-mon-yyyy')

    and i.status in (', 'E')

    )

    SELECT ID, start_date, cust_type

    gross_amount, net_amount

    of got_rnk

    where rnk = 1

    ;

    Results of your sample data:

    ID START_DATE GROSS_AMOUNT NET_AMOUNT CUST_TYPE

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

    1 1 June 2014 78 189 364

    1 1 June 2014 78 189 278

    1 1 June 2014 78 189 208

    1 12 August 2014 2 19 38

    1 12 August 2014 2 19 108

    1 12 August 2014 2 19 194

    2 13 October 2014 2 190 207

    2 13 October 2014 2 190 365

    2 13 October 2014 2 190 199

    3 March 26, 2014 4 0 175

    3 1 June 2014 78 0 189

    3 12 August 2014 2 0 19

    3 August 13, 2014 2 0 19

    3 1 December 2014 91 0 89

  • 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.

  • Outer Join and joining several Tables

    Hello

    Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product

    I have three tables AddProject, AssociateProjectLead, AddAssociate. Now I'm generating a report who will join AddProject and AssociateProjectLead for a list of all the projects, even if it doenst have a project coordinator. I used the outer join for this. However, if I want the name of the project leader, I need to search for AddAssociate table. By joining this table also, the outer join is no longer valid. Please see the result below

    CREATE TABLE  "ADDPROJECT" 
       (     "VERSIONNO" NUMBER(*,0), 
         "PROJID" VARCHAR2(20), 
         "PROJNAME" VARCHAR2(60), 
         "PROJSTARTDATE" DATE, 
         "PROJSTATUS" VARCHAR2(20), 
         "PROJENDDATE" DATE, 
         "PROJENDTYPE" VARCHAR2(20), 
         "PROJENDREASON" VARCHAR2(1000), 
         "UCPROJECTMANAGER" VARCHAR2(20), 
         "FROMDATE" DATE, 
         "TODATE" DATE, 
         "SRCHFIELD" VARCHAR2(20), 
         "OPERATOR" VARCHAR2(20), 
         "PARENTPROJID" VARCHAR2(20), 
         "PROJHIDDENDATE" VARCHAR2(20), 
          CONSTRAINT "PK_B36" PRIMARY KEY ("PROJID", "PROJHIDDENDATE") ENABLE
       )
    
    
    CREATE TABLE  "ADDASSOCIATE" 
       (     "VERSIONNO" NUMBER(*,0), 
         "ASSOCIATEID" NUMBER(9,0) NOT NULL ENABLE, 
         "ASSOCIATENAME" VARCHAR2(100) NOT NULL ENABLE, 
         "CTOJOINDATE" DATE, 
         "STATUS" VARCHAR2(20), 
         "ENDDATE" DATE, 
         "SRCHFIELD" VARCHAR2(20), 
         "OPERATOR" VARCHAR2(20), 
         "FROMDATE" DATE, 
         "TODATE" DATE, 
          CONSTRAINT "PK_B23" PRIMARY KEY ("ASSOCIATEID") ENABLE
       )
    
    CREATE TABLE  "ASSOCIATEPROJECTLEAD" 
       (     "VERSIONNO" NUMBER(*,0), 
         "PROJLEADASSOID" NUMBER(9,0), 
         "PROJID" VARCHAR2(20), 
         "ASSOCIATEID" NUMBER(9,0), 
         "PROJLEADSTARTDATE" DATE, 
         "STATUS" VARCHAR2(20), 
         "ASSOCPROJHIDDENDATE" VARCHAR2(20), 
         "PROJHIDDENDATE" VARCHAR2(20), 
         "ENDDATE" DATE, 
          CONSTRAINT "PK_B40" PRIMARY KEY ("ASSOCIATEID", "PROJID", "ASSOCPROJHIDDENDATE") ENABLE
       )
    
    
    elect ap.projid,apl.associateid
    from addproject ap, associateprojectlead apl
    where ap.projid = apl.projid(+)
    and ap.projhiddendate = apl.projhiddendate(+)
    
    
    PROJID ASSOCIATEID 
    Proj08 75825 
    Proj09 75825 
    Proj10 75825 
    Proj11 75825 
    Proj12 259811 
    Proj01 103035 
    Proj02 103035 
    Proj03 320092 
    Proj04 320092 
    Proj05 120974 
    Proj06 367393 
    Proj07 117618 
    Proj07 224882 
    Proj07 246652 
    prj001 -  
    prj001 -  
    
    16 rows returned in 0.00 seconds
    
    
    select ap.projid,apl.associateid,aa.associatename
    from addproject ap, associateprojectlead apl,addassociate aa
    where ap.projid = apl.projid(+)
    and ap.projhiddendate = apl.projhiddendate(+)
    and apl.associateid = aa.associateid
    
    
    PROJID ASSOCIATEID ASSOCIATENAME 
    Proj11 75825 Amarendra Kumar Singh 
    Proj10 75825 Amarendra Kumar Singh 
    Proj09 75825 Amarendra Kumar Singh 
    Proj08 75825 Amarendra Kumar Singh 
    Proj02 103035 Rajesh Jayaprakash 
    Proj01 103035 Rajesh Jayaprakash 
    Proj07 117618 Chetan Malhotra 
    Proj05 120974 Perumal Rajaram 
    Proj07 224882 Dilshad Ahmad 
    Proj07 246652 Shankar Kausley 
    Proj12 259811 Arunchandar Arun Vasan 
    Proj04 320092 Venkatesh Sarangan 
    Proj03 320092 Venkatesh Sarangan 
    Proj06 367393 Venkata Ramakrishna P 
    
    14 rows returned in 0.00 seconds
    How can I select all the values in table AddProject?

    Published by: Pramukh on August 23, 2012 12:18

    Hello

    I could get the result with a bit of modification

    select ap.projid,
           apl.associateid,
           aa.associatename
      from addproject ap
           left outer join
           associateprojectlead apl
        on ap.projid = apl.projid
       and ap.projhiddendate = apl.projhiddendate
           left outer join
           addassociate aa
        on apl.associateid = aa.associateid
    

    As a follow-up, I have a request more. In the report form, the user can select a particular project ID and the report should be generated as a result. For example;-he wants to see the results of the only "Proj08". I get the output as below, while the result should display only the details of 'Proj08 '.

    select ap.projid,
           apl.associateid,
           aa.associatename
      from addproject ap
           left outer join
           associateprojectlead apl
        on ap.projid = apl.projid
       and ap.projhiddendate = apl.projhiddendate
       and ap.projID = 'Proj08'
           left outer join
           addassociate aa
        on apl.associateid = aa.associateid
    ORDER BY ap.projID
    
    PROJID ASSOCIATEID ASSOCIATENAME
    Proj01 -  -
    Proj02 -  -
    Proj03 -  -
    Proj04 -  -
    Proj05 -  -
    Proj06 -  -
    Proj07 -  -
    Proj08 75825 Amarendra Kumar Singh
    Proj09 -  -
    Proj10 -  -
    Proj11 -  -
    Proj12 -  -
    prj001 -  -
    prj001 -  -  
    
  • CSS3 multiple columns and Internet Exploder

    I have developed a web page that needs a two column layout and has decided to use CSS3 to describe the columns: very simple:

    {.twocol}

    border-style: solid;

    border width: 7px;

    border-color: #0476ac;

    -webkit-border-radius: 20px;

    -moz-border-radius: 20px;

    border-radius: 20px;

    -moz-column-count: 2;

    -moz-column-gap: 20px;

    -webkit-column-count: 2;

    -webkit-column-gap: 20px;

    number of columns: 2;

    column interval: 20px;

    padding: 10px;

    height: 300px;

    }

    CSS bold described the two-column layout that I want.

    Looked in Internet Exploiter version 9 and it failed. And, since the text was missing I did the 'old skool' method:

    {.colLeft}

    Width: 410px;

    }

    {.colRight}

    Width: 410px;

    float: right;

    }

    Then in HTML:

    < section class = "twocol" >

    < div class = "colRight" >

    < p > right column of things comes here < /p >

    < / div >

    < div class = "colLeft" >

    Insert here the stuff left column < p > < /p >

    < / div >

    < / section >

    I have commented things in "BOLD" in my style sheet.

    Here's my question:

    Since I'm on the HTML5 Shiv, shouldn't that have created the support for multiple columns in CSS3 declarations or is it simply too complex?

    HTML5 Shiv, as its name suggests, is strictly for the support of HTML5 tags in pre - IE9.  It will not help you with CSS level 3.

    Nancy O.

  • OBIEE - outer joins

    Hello

    I have create a join foreign key between the table dimension and in the physical layer. Is it possible to create an outer join on the columns, the option (driving and type) in properties is gray and is by default 'indoor '. How you can activate this option?

    Thank you

    Hello

    You create outer joins in the business layer, but the OBIEE outer joins are not like SQL outer join. They can lead to strange errors.

    Its better to do these things in ETL.

    Thank you
    Sandeep

  • Outer join or a function of the level line

    Hi all

    I have a question which involves five tables T1, R1, R2, R3, and R4. T1 is an operating table, while R1, R2, R3, and R4 are tables of references (tables parent, with the foreign keys defined in T1). Table T1 contains always referenced data R2 and R1. BUT table T1 can sometimes contain NULL for R3 and R4.

    Now my question is simple;
    Should I use an OUTER Join for R3 and R4 in the query? as

    < code >
    Select T1.col1, R1.col2, R2.col2, R3.col2, R4.col2
    T1, R1, R2, R3, R4
    where T1.col2 = R1.col1
    and T1.col3 = R2.col1
    and T1.col4 = R3.col1 (+)
    and T1.col5 = R4.col1 (+)
    < code >

    OR

    Can I use level functions online for R3 and R4, as

    < code >
    Select T1.col1, R1.col2, R2.col2,
    (Select R3.col2 in R3 where R3.col1 = T1.col4),
    (Select R4.col2 in R4 where R4.col1 = T1.col5)
    T1, R1, R2
    where T1.col2 = R1.col1
    and T1.col3 = R2.col1
    < code >

    Which approach is better and why?

    Records in T1 = 2 000 000
    R1 = 1000 records
    Records in R2 = 300
    Records in R3 = 1800
    Records in R4 = 200

    Please note that all foreign keys are indexed, there are primary keys for all the tables in R

    Thank you
    QQ.

    According to the 'official' documentation the outer join should be the by far best choice, because I still think the Oracle documentation says that the subquery will be executed for each row of the main query.

    But the Oracle execution engine is a lot smarter (I think from Oracle 8i) and offers a "Value for the filter" feature supposedly which also applies to the "scalar subqueries" you are talking about to (but only if the subquery is considered to be deterministic, i.e. returns always the same value for the same input value of the main request).

    Basically, this Treaty optimization the subquery as a function of an input value (the link to the main request) and an output value (the result of the query) and maintains a hash table in memory of pairs of input/output value. The size of the changes table in memory from one version to the other, I think in 9i, it is set by default to 256 entries but in 10g, it is limited in size and therefore the number of entries depends on the size of the values to store.

    The effectiveness of this optimization of memory-search in the table depends on certain factors such as the number of pairs of distinct value, the order of the incoming values and collisions in the table which can be occur according to hash values.

    Jonathan Lewis has an in-depth coverage of these mechanism in its "cost-based Oracle: Fundamentals" book.

    To make a long story short, since your tables R3 and R4 are relatively low, you might want to give a chance, because these optimizations could work very well in your particular case, but unfortunately the real result is simply unpredictable due to the above constraints, including the order of the incoming values.

    Kind regards
    Randolf

    Oracle related blog stuff:
    http://Oracle-Randolf.blogspot.com/

    SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676 /.
    http://sourceforge.NET/projects/SQLT-pp/

  • left outer join and the where clause for the table to the right

    I want to join two tables a and b, where a is a must and b is a result set in option. When I use a left outer join to a to b, I want to achieve:

    1. Select a single column, two columns of b (not the join columns)
    2 - even if theres no friendly on the join column does not return data from one.
    3. If there is a match applies when the criteria on column b (table in option)

    so, how can I avoid no_data_found in this case? When I apply where criteria for b, so it does not return the data from one, which is a must.

    Sounds like a regular outer join to me...

    select a.col1, b.col2, b.col2
    from   tableA a
           left outer join tableB b
           on (a.id = b.id and b.colX = 'X')
    
  • Outer Join don't know the smallest and largest join until the run time column

    Hello, I have three tables and I don't know which one is the smallest game of the outer join column. So, how can I join them and the following output.
    If I know in advance, which is the largest and which one is the smallest game so I can use something like below, but what if I don't know which is the smallest together or we're great together?

    Test case and the request for a fixed set, smaller and more large set case:


    Select x1.nm, cnt1, cnt2, cvt3.cnt cnt3
    Of
    (
    Select cvt1.nm, cvt1.cnt cnt1, cnt2 in cvt1 cvt2.cnt, cvt2
    where cvt1.nm = cvt2.nm (+)
    ) x 1, cvt3
    where x1.nm = cvt3.nm (+)


    NM CNT1, CNT2 CNT3
    -- ---------- ---------- ----------
    A 1 101
    B 2 102
    C 3
    4 1001 D
    5 1002 E

    create table cvt1 (nm varchar2 (1), cnt1 number)
    /
    create table cvt2 (nm varchar2 (1), number of cnt2)
    /
    create table cvt3 (nm varchar2 (1), cnt3 number)
    /

    insert into cvt1 select 'A', 1 double
    /
    insert into cvt1 select 'B', 2 of the double
    /
    insert into cvt1 select 'C', 3 double
    /
    INSERT into cvt1 select would be ', 4 of the double
    /
    insert into cvt1 select 'E', 5 double

    Insert into select cvt2 'A', 101 double
    /
    Insert into cvt2 select 'B', 102 of the double
    /
    Insert into select 'C', 103 double cvt2
    /

    INSERT into cvt3 select would be ', double 1001
    /
    insert into cvt3 select 'E', 1002 double
    /

    Published by: xwo0owx on March 31, 2011 12:48
  • need help for an outer join query

    Hi friends...
    I have oracle 10g...
    I have a question which involve is joining three tables...

    the query is as follows:
    SELECT DISTINCT MU.MKT_ID                  "PAR ID",
                       MU.MKT_ID                  "ROOT ID",
                     MSU.SPEC_ID                "ID",
                   SU.SPEC_DESC                "DESC",
               SU.SPEC_CD          "SPEC CD"
    
                  FROM IPOADM_BATCH.MKT_UV1        MU,
                         IPOADM_BATCH.MKT_SPEC_UV1   MSU,
                 IPOADM_BATCH.SPEC_UV1       SU
    
                   WHERE MSU.MKT_ID  = MU.MKT_ID
               AND MSU.SPEC_ID = SU.SPEC_ID
             AND SU.SPEC_GRP_OR_CMPSTN_CD = 'C';
    in my front end application has some delete operations that removes specific data of the IPOADM_BATCH. MKT_SPEC_UV1 due to which the above query is nor fetch all rows.
    the relationship between the tables is clearly from the above query...

    I have the data in IPOADM_BATCH. MKT_UV1 and IPOADM_BATCH. Table of SPEC_UV1 after the delete operation

    now, I want the query above to retrieve data from IPOADM_BATCH. MKT_UV1 with small changes to the above query even if there is no data in IPOADM_BATCH. MKT_SPEC_UV1.

    I thought that if I use an outer join I can get it, but here I have to join three tables-join condition is based on the table that doesn't have a data...


    so please help me guys how can I change the query to get my desired out put...

    Hello

    There are several different things you could mean by it.

    Here's how to join the tables to get one of them:

    SELECT DISTINCT  mu.mkt_id                  "PAR ID",
                     mu.mkt_id                  "ROOT ID",
                     msu.spec_id                "ID",
                     su.spec_desc               "DESC",
                     su.spec_cd                   "SPEC CD"
    FROM           ipoadm_batch.mkt_uv1        mu
    LEFT OUTER JOIN      ipoadm_batch.mkt_spec_uv1   msu  ON   msu.mkt_id               = mu.mkt_id
    LEFT OUTER JOIN  ipoadm_batch.spec_uv1       su       ON   msu.spec_id              = su.spec_id
                                                  AND  su.spec_grp_or_cmpstn_cd = 'C'
    ;
    

    If it does not matter what it is that you want, and then after a small example of data (CREATE TABLE and INSERT, only relevant columns instructions) for all the tables and the results desired from these data.
    Highlight a few places where the above querry is the production of incorrect results of your sample data and explains how to get the correct results in these places.

  • Comparing the same outer join column.

    Hello

    I have the following query.
    SELECT Replens.Date1               AS date1,
      Replens.USER_ID                  AS Operator1,
      Picks.USER_ID                    AS Operator1,
      Users.Time                       AS Logged_in_hours,
      Replens.Quantity                 AS Pallet_replened,
      SUM(Replens.Quantity/Users.Time) AS Replen_rate,
      Picks.Quantity                   AS Cases_picked,
      SUM(Picks.Quantity/Users.Time)   AS Pick_rate
    FROM
      (SELECT libclientreports.getshift(itl.dstamp) Date1,
        ITL.USER_ID,
        COUNT(ITL.tag_id) Quantity
      FROM INVENTORY_TRANSACTION ITL
      WHERE ITL.code                                     = 'Replenish'
      AND TO_CHAR(itl.dstamp, 'DD-Mon-YYYY HH24:MI:SS') >= '01-Mar-2010 06:00:00'
      AND TO_CHAR(itl.dstamp, 'DD-Mon-YYYY HH24:MI:SS') <= '01-Mar-2010 18:00:00'
      GROUP BY libclientreports.getshift(itl.dstamp),
        ITL.USER_ID
      ORDER BY ITL.USER_ID,
        libclientreports.getshift(itl.dstamp)
      ) Replens,
      (SELECT libclientreports.getshift(itl.dstamp) Date1,
        ITL.USER_ID,
        SUM(ITL.update_qty) Quantity
      FROM INVENTORY_TRANSACTION ITL
      WHERE ITL.to_loc_id                                = 'CONTAINER'
      AND TO_CHAR(itl.dstamp, 'DD-Mon-YYYY HH24:MI:SS') >= '01-Mar-2010 06:00:00'
      AND TO_CHAR(itl.dstamp, 'DD-Mon-YYYY HH24:MI:SS') <= '01-Mar-2010 18:00:00'
      GROUP BY libclientreports.getshift(itl.dstamp),
        ITL.USER_ID
      ORDER BY ITL.USER_ID,
        libclientreports.getshift(itl.dstamp)
      ) Picks,
      (SELECT USER_ID,
        SUM(LibClientReports.getLoggedInHours (USER_ID, to_date('01-Mar-2010 06:00:00', 'DD-Mon-YYYY HH24:MI:SS'), to_date('01-Mar-2010 18:00:00', 'DD-Mon-YYYY HH24:MI:SS')) )/60 TIME
      FROM APPLICATION_USER
      GROUP BY USER_ID
      ) Users
    WHERE Users.Time != '0'
    AND Users.USER_ID = Picks.USER_ID (+)
    AND Users.USER_ID = Replens.USER_ID (+)
    GROUP BY Replens.Date1,
      Replens.USER_ID,
      Picks.USER_ID,
      Users.Time,
      Picks.Quantity,
      Replens.Quantity
    ORDER BY Replens.USER_ID,
      Replens.Date1
    The problem I have is with the operator1 columns, I've done outer joins on the Users table that contains all users that will be returned in the tables of the peaks and Replens.
    However, I want to merge this operator1 into one column. For example, here is the current data, I have for the two columns of the operator 1;
    Operator1       Operator1_1
    
    D9AGY19             D9AGY19
    D9BEELB             D9BEELB
    D9FULOPS     (null)
    D9GAWKOWA     D9GAWKOWA
    D9LIDDING     D9LIDDING
    D9NOWAKS     D9NOWAKS
    (null)             D9AGY10
    (null)             D9AGY13
    (null)             D9AGY15
    (null)             D9AGY17
    And here is the data I want to see;
    Operator1
    
    D9AGY19
    D9BEELB
    D9FULOPS
    D9GAWKOWA
    D9LIDDING
    D9NOWAKS
    D9AGY10
    D9AGY13
    D9AGY15
    D9AGY17
    Notice the USER_ID to replace the values (null).

    Could someone please explain to me how to make this happen? If you want more information please let me know.


    Kind regards

    SM.

    This should do if Op1 and Op1_1 are always the same or one or the other is null. If both are filled and have different values, then it will not work:

    nvl(Replens.USER_ID, Picks.User_ID) as                  AS Operator1
    
  • Active Directory - join the domain for multiple devices

    Hi all

    I need your expertise to advice me how join domain for multiple devices.

    Currently my organization have more than 10,000 computers are made up of Windows XP, 7, 8 and 10.

    We will deploy new Active Directory server in the data center.

    Currently, we plan to go every computer/devices to perform a field joints. This method will take much time to complete the 10,000 devices.

    is there another method to do this?

    is there a method that all devices will join automatically field when it is connected to the corporate network.

    Thank you.

    Hello

    Post your question in the TechNet Server Forums, as your question kindly is beyond the scope of these Forums.

    http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    See you soon.

Maybe you are looking for