Avoid duplicates when i join with bridge table

i have a requirement with many to many relations between fact and dimention,that is the reason we have created bridge tables in the database.
if i execute only query on the fact table it is giving correct results.when ever i join with bridge tables it is returning lot of duplicate records.
Ex:
select amount from fact where column = 'xyz'
100
then it is returing one record.(this value is correct)
when ever i join this fact table with bridge table then it is returning duplicate records.
select a.amount from fact inner join bridge table b on a.fk=b.fk
100
100
100
100
100
how many number of fk's associated that many 100's are generating
in this case it is returning duplicate records.
in the RPD i have joined like one to many between fact to dimention.
if anybody face this type of situation please let me know how to resolve this?(FYI...i would have to do this before BM..because lot of other thing are coming into picture on BMM that's why i should have to achieve this in either physical or in database.
Thanks in advance
Edited by: user12077461 on Apr 3, 2011 6:39 PM
Edited by: user12077461 on Apr 17, 2011 4:51 PM

I understand what you say but partially.. please explain in more detail how to do that;
How should look the adrese_nezonate block, then? I have to add a 'name' column and set copy value from item property to 'STREETS.NAME', and database_property No?
Then the post-query trigger how should look like (the order by clause)? The post-query sends the entire query (with where/order by clauses) to the server, but in that "select... where... order by" (built dynamically) there are only columns from that block (adrese_nezonate). I need to join with streets, INSIDE that query.
Thanks.

Similar Messages

  • Weight factors in a many-to-many relationship with bridge table

    Hi, I have the same N:N relationship schema of this link:
    http://www.rittmanmead.com/2008/08/28/the-mystery-of-obiee-bridge-tables/
    In my bridge table I have a weight factor for every couple (admission,diagnosis). If I aggregate and query in Answers these columns:
    DIAGNOSIS | ADMISSIONS_COSTS
    every single diagnosis has the sum of the WHOLE Admission_cost it refers to, not its contribute to it (for example 0.30 as weight factor). The result is an ADMISSION_COSTS sum larger than the ADMISSION_COSTS sum in the lowest detail level, because it sums many times the same cost.
    How could I use my weight factor and calculate the right diagnosis contribute to its admission? In BI Admin I tried to build a calculated LogicalColumn based on Physical column, but in the expression builder I can select only the ADMISSION_COST measure physical column, and it doesn't let me pick the weight factor from the bridge table.
    Thanks in advance!

    I'm developing a CS degree project with 2 professors, Matteo Golfarelli and Stefano Rizzi, who have developed the Dimensional Fact Model for data warehouses and wrote many books about it.
    They followed the Kimball theory about N:N and used its bridge table concept, so when I said them that in OBIEE there is this definition they were very happy.
    But they stopped this happiness when I said that bridge tables only connect fact tables to dimension tables, and to create N:N between levels at higher aggregation we should use logical joins as you said in your blog. I need to extract metadata concepts from UDML exportation language, and about N:N I can do it only with bridge table analysis, I can't extract and identify a N:N level relationship from a multiple join schema as in your blog... this is the limit of your solution for our project, only this!
    PS: sorry for my english, I'm italian!
    thanks for the replies!

  • Tables of View Joined in Wrong Order When View Joined to Other Tables

    I have the following view:
    select
         distinct
         'PKG' item_type_code,
         msibk.organization_id,
         msibk.inventory_item_id
    from
         mtl_system_items_b_kfv msibk,
         mtl_item_categories mic,
         mtl_default_category_sets mdcs,
         mtl_categories_b_kfv mcbk
    where
         msibk.organization_id = mic.organization_id
         and msibk.inventory_item_id = mic.inventory_item_id
         and mic.category_set_id = mdcs.category_set_id
         --1 Inventory (Lookup = MTL_FUNCTIONAL_AREAS)
         and mdcs.functional_area_id = 1
         and mic.category_id = mcbk.category_id
         and mcbk.segment1 = 'EXP'
         and mcbk.segment2 in ( 'PACKAGING' )When I access the columns like this:
    select
    from
         xxcus_mtl_sys_item_types_v
    where
         organization_id = :1
         and inventory_item_id = :2
         and item_type_code = :3It correctly accesses MTL_SYSTEM_ITEMS_B second in the explain plan and everything is good.
    But when it is part of a join, it accesses MTL_SYSTEM_ITEMS_B last in the explain plan and has performance issues.
    select
         msi.segment1
    from
         xxcus_mtl_sys_item_types_v x,
         mtl_system_items msi
    where
         msi.organization_id = x.organization_id
         and msi.inventory_item_id = x.inventory_item_id
         and x.item_type_code = 'PAK'Any ideas why the view tables are getting joined incorrectly when the view is joined with another table?
    Thanks,
    Kurz

    The query I posted for the view is just an excerpt. It is several nearly identical queries with UNION ALL between them. I get the same results when I have only one query in the view.
    Here is the explain plan for the first query:
    | Id  | Operation                          | Name                         | Rows  | Bytes | Cost (%CPU)|
    |   0 | SELECT STATEMENT                   |                              |     5 |   160 |    25  (20)|
    |   1 |  VIEW                              | XXCUS_MTL_SYS_ITEM_TYPES_V   |     5 |   160 |    25  (20)|
    |   2 |   UNION-ALL                        |                              |       |       |            |
    |   3 |    SORT UNIQUE NOSORT              |                              |     1 |    71 |     5  (20)|
    |*  4 |     FILTER                         |                              |       |       |            |
    |   5 |      NESTED LOOPS                  |                              |     1 |    71 |     4   (0)|
    |   6 |       NESTED LOOPS                 |                              |     1 |    36 |     3   (0)|
    |   7 |        NESTED LOOPS                |                              |     1 |    17 |     1   (0)|
    |   8 |         TABLE ACCESS BY INDEX ROWID| MTL_DEFAULT_CATEGORY_SETS    |     1 |     8 |     1   (0)|
    |*  9 |          INDEX UNIQUE SCAN         | MTL_DEFAULT_CATEGORY_SETS_U1 |     1 |       |     0   (0)|
    |* 10 |         INDEX UNIQUE SCAN          | MTL_SYSTEM_ITEMS_B_U1        |     1 |     9 |     0   (0)|
    |* 11 |        INDEX RANGE SCAN            | MTL_ITEM_CATEGORIES_U1       |     1 |    19 |     2   (0)|
    |* 12 |       TABLE ACCESS BY INDEX ROWID  | MTL_CATEGORIES_B             |     1 |    35 |     1   (0)|
    |* 13 |        INDEX UNIQUE SCAN           | MTL_CATEGORIES_B_U1          |     1 |       |     0   (0)|
    |  14 |    SORT UNIQUE NOSORT              |                              |     1 |    63 |     5  (20)|
    |* 15 |     FILTER                         |                              |       |       |            |
    |  16 |      NESTED LOOPS                  |                              |     1 |    63 |     4   (0)|
    |  17 |       NESTED LOOPS                 |                              |     1 |    36 |     3   (0)|
    |  18 |        NESTED LOOPS                |                              |     1 |    17 |     1   (0)|
    |  19 |         TABLE ACCESS BY INDEX ROWID| MTL_DEFAULT_CATEGORY_SETS    |     1 |     8 |     1   (0)|
    |* 20 |          INDEX UNIQUE SCAN         | MTL_DEFAULT_CATEGORY_SETS_U1 |     1 |       |     0   (0)|
    |* 21 |         INDEX UNIQUE SCAN          | MTL_SYSTEM_ITEMS_B_U1        |     1 |     9 |     0   (0)|
    |* 22 |        INDEX RANGE SCAN            | MTL_ITEM_CATEGORIES_U1       |     1 |    19 |     2   (0)|
    |* 23 |       TABLE ACCESS BY INDEX ROWID  | MTL_CATEGORIES_B             |     1 |    27 |     1   (0)|
    |* 24 |        INDEX UNIQUE SCAN           | MTL_CATEGORIES_B_U1          |     1 |       |     0   (0)|
    |  25 |    SORT UNIQUE NOSORT              |                              |     1 |    71 |     5  (20)|
    |* 26 |     FILTER                         |                              |       |       |            |
    |  27 |      NESTED LOOPS                  |                              |     1 |    71 |     4   (0)|
    |  28 |       NESTED LOOPS                 |                              |     1 |    36 |     3   (0)|
    |  29 |        NESTED LOOPS                |                              |     1 |    17 |     1   (0)|
    |  30 |         TABLE ACCESS BY INDEX ROWID| MTL_DEFAULT_CATEGORY_SETS    |     1 |     8 |     1   (0)|
    |* 31 |          INDEX UNIQUE SCAN         | MTL_DEFAULT_CATEGORY_SETS_U1 |     1 |       |     0   (0)|
    |* 32 |         INDEX UNIQUE SCAN          | MTL_SYSTEM_ITEMS_B_U1        |     1 |     9 |     0   (0)|
    |* 33 |        INDEX RANGE SCAN            | MTL_ITEM_CATEGORIES_U1       |     1 |    19 |     2   (0)|
    |* 34 |       TABLE ACCESS BY INDEX ROWID  | MTL_CATEGORIES_B             |     1 |    35 |     1   (0)|
    |* 35 |        INDEX UNIQUE SCAN           | MTL_CATEGORIES_B_U1          |     1 |       |     0   (0)|
    |  36 |    SORT UNIQUE NOSORT              |                              |     1 |    71 |     5  (20)|
    |* 37 |     FILTER                         |                              |       |       |            |
    |  38 |      NESTED LOOPS                  |                              |     1 |    71 |     4   (0)|
    |  39 |       NESTED LOOPS                 |                              |     1 |    36 |     3   (0)|
    |  40 |        NESTED LOOPS                |                              |     1 |    17 |     1   (0)|
    |  41 |         TABLE ACCESS BY INDEX ROWID| MTL_DEFAULT_CATEGORY_SETS    |     1 |     8 |     1   (0)|
    |* 42 |          INDEX UNIQUE SCAN         | MTL_DEFAULT_CATEGORY_SETS_U1 |     1 |       |     0   (0)|
    |* 43 |         INDEX UNIQUE SCAN          | MTL_SYSTEM_ITEMS_B_U1        |     1 |     9 |     0   (0)|
    |* 44 |        INDEX RANGE SCAN            | MTL_ITEM_CATEGORIES_U1       |     1 |    19 |     2   (0)|
    |* 45 |       TABLE ACCESS BY INDEX ROWID  | MTL_CATEGORIES_B             |     1 |    35 |     1   (0)|
    |* 46 |        INDEX UNIQUE SCAN           | MTL_CATEGORIES_B_U1          |     1 |       |     0   (0)|
    |  47 |    SORT UNIQUE NOSORT              |                              |     1 |    71 |     5  (20)|
    |* 48 |     FILTER                         |                              |       |       |            |
    |  49 |      NESTED LOOPS                  |                              |     1 |    71 |     4   (0)|
    |  50 |       NESTED LOOPS                 |                              |     1 |    36 |     3   (0)|
    |  51 |        NESTED LOOPS                |                              |     1 |    17 |     1   (0)|
    |  52 |         TABLE ACCESS BY INDEX ROWID| MTL_DEFAULT_CATEGORY_SETS    |     1 |     8 |     1   (0)|
    |* 53 |          INDEX UNIQUE SCAN         | MTL_DEFAULT_CATEGORY_SETS_U1 |     1 |       |     0   (0)|
    |* 54 |         INDEX UNIQUE SCAN          | MTL_SYSTEM_ITEMS_B_U1        |     1 |     9 |     0   (0)|
    |* 55 |        INDEX RANGE SCAN            | MTL_ITEM_CATEGORIES_U1       |     1 |    19 |     2   (0)|
    |* 56 |       TABLE ACCESS BY INDEX ROWID  | MTL_CATEGORIES_B             |     1 |    35 |     1   (0)|
    |* 57 |        INDEX UNIQUE SCAN           | MTL_CATEGORIES_B_U1          |     1 |       |     0   (0)|
    --------------------------------------------------------------------------------------------------------Here is the explain plan for the second query:
    | Id  | Operation                           | Name                         | Rows  | Bytes | Cost (%CPU)|
    |   0 | SELECT STATEMENT                    |                              |     5 |   240 |    10  (50)|
    |   1 |  NESTED LOOPS                       |                              |     5 |   240 |    10  (50)|
    |   2 |   VIEW                              | XXCUS_MTL_SYS_ITEM_TYPES_V   |     5 |   160 |     5 (100)|
    |   3 |    UNION-ALL                        |                              |       |       |            |
    |   4 |     HASH UNIQUE                     |                              |     1 |    71 |     1 (100)|
    |*  5 |      FILTER                         |                              |       |       |            |
    |   6 |       NESTED LOOPS                  |                              |    17 |  1207 |    77   (0)|
    |   7 |        NESTED LOOPS                 |                              |    16 |   992 |    77   (0)|
    |   8 |         NESTED LOOPS                |                              |     1 |    43 |     7   (0)|
    |   9 |          TABLE ACCESS BY INDEX ROWID| MTL_DEFAULT_CATEGORY_SETS    |     1 |     8 |     1   (0)|
    |* 10 |           INDEX UNIQUE SCAN         | MTL_DEFAULT_CATEGORY_SETS_U1 |     1 |       |     0   (0)|
    |* 11 |          TABLE ACCESS BY INDEX ROWID| MTL_CATEGORIES_B             |     1 |    35 |     6   (0)|
    |* 12 |           INDEX RANGE SCAN          | MTL_CATEGORIES_B_N1          |    44 |       |     2   (0)|
    |* 13 |         TABLE ACCESS BY INDEX ROWID | MTL_ITEM_CATEGORIES          |    49 |   931 |    70   (0)|
    |* 14 |          INDEX RANGE SCAN           | MTL_ITEM_CATEGORIES_N3       |   441 |       |     4   (0)|
    |* 15 |        INDEX UNIQUE SCAN            | MTL_SYSTEM_ITEMS_B_U1        |     1 |     9 |     0   (0)|
    |  16 |     HASH UNIQUE                     |                              |     1 |    63 |     1 (100)|
    |* 17 |      FILTER                         |                              |       |       |            |
    |  18 |       NESTED LOOPS                  |                              |  2158 |   132K|   250   (1)|
    |  19 |        NESTED LOOPS                 |                              |  2134 |   112K|   249   (0)|
    |  20 |         NESTED LOOPS                |                              |    44 |  1540 |     7   (0)|
    |  21 |          TABLE ACCESS BY INDEX ROWID| MTL_DEFAULT_CATEGORY_SETS    |     1 |     8 |     1   (0)|
    |* 22 |           INDEX UNIQUE SCAN         | MTL_DEFAULT_CATEGORY_SETS_U1 |     1 |       |     0   (0)|
    |  23 |          TABLE ACCESS BY INDEX ROWID| MTL_CATEGORIES_B             |    44 |  1188 |     6   (0)|
    |* 24 |           INDEX RANGE SCAN          | MTL_CATEGORIES_B_N1          |    44 |       |     2   (0)|
    |* 25 |         TABLE ACCESS BY INDEX ROWID | MTL_ITEM_CATEGORIES          |    49 |   931 |    70   (0)|
    |* 26 |          INDEX RANGE SCAN           | MTL_ITEM_CATEGORIES_N3       |   441 |       |     4   (0)|
    |* 27 |        INDEX UNIQUE SCAN            | MTL_SYSTEM_ITEMS_B_U1        |     1 |     9 |     0   (0)|
    |  28 |     HASH UNIQUE                     |                              |     1 |    71 |     1 (100)|
    |* 29 |      FILTER                         |                              |       |       |            |
    |  30 |       NESTED LOOPS                  |                              |    33 |  2343 |    77   (0)|
    |  31 |        NESTED LOOPS                 |                              |    33 |  2046 |    77   (0)|
    |  32 |         NESTED LOOPS                |                              |     1 |    43 |     7   (0)|
    |  33 |          TABLE ACCESS BY INDEX ROWID| MTL_DEFAULT_CATEGORY_SETS    |     1 |     8 |     1   (0)|
    |* 34 |           INDEX UNIQUE SCAN         | MTL_DEFAULT_CATEGORY_SETS_U1 |     1 |       |     0   (0)|
    |* 35 |          TABLE ACCESS BY INDEX ROWID| MTL_CATEGORIES_B             |     1 |    35 |     6   (0)|
    |* 36 |           INDEX RANGE SCAN          | MTL_CATEGORIES_B_N1          |    44 |       |     2   (0)|
    |* 37 |         TABLE ACCESS BY INDEX ROWID | MTL_ITEM_CATEGORIES          |    49 |   931 |    70   (0)|
    |* 38 |          INDEX RANGE SCAN           | MTL_ITEM_CATEGORIES_N3       |   441 |       |     4   (0)|
    |* 39 |        INDEX UNIQUE SCAN            | MTL_SYSTEM_ITEMS_B_U1        |     1 |     9 |     0   (0)|
    |  40 |     HASH UNIQUE                     |                              |     1 |    71 |     1 (100)|
    |* 41 |      FILTER                         |                              |       |       |            |
    |  42 |       NESTED LOOPS                  |                              |    17 |  1207 |    77   (0)|
    |  43 |        NESTED LOOPS                 |                              |    16 |   992 |    77   (0)|
    |  44 |         NESTED LOOPS                |                              |     1 |    43 |     7   (0)|
    |  45 |          TABLE ACCESS BY INDEX ROWID| MTL_DEFAULT_CATEGORY_SETS    |     1 |     8 |     1   (0)|
    |* 46 |           INDEX UNIQUE SCAN         | MTL_DEFAULT_CATEGORY_SETS_U1 |     1 |       |     0   (0)|
    |* 47 |          TABLE ACCESS BY INDEX ROWID| MTL_CATEGORIES_B             |     1 |    35 |     6   (0)|
    |* 48 |           INDEX RANGE SCAN          | MTL_CATEGORIES_B_N1          |    44 |       |     2   (0)|
    |* 49 |         TABLE ACCESS BY INDEX ROWID | MTL_ITEM_CATEGORIES          |    49 |   931 |    70   (0)|
    |* 50 |          INDEX RANGE SCAN           | MTL_ITEM_CATEGORIES_N3       |   441 |       |     4   (0)|
    |* 51 |        INDEX UNIQUE SCAN            | MTL_SYSTEM_ITEMS_B_U1        |     1 |     9 |     0   (0)|
    |  52 |     HASH UNIQUE                     |                              |     1 |    71 |     1 (100)|
    |* 53 |      FILTER                         |                              |       |       |            |
    |  54 |       NESTED LOOPS                  |                              |    17 |  1207 |    77   (0)|
    |  55 |        NESTED LOOPS                 |                              |    16 |   992 |    77   (0)|
    |  56 |         NESTED LOOPS                |                              |     1 |    43 |     7   (0)|
    |  57 |          TABLE ACCESS BY INDEX ROWID| MTL_DEFAULT_CATEGORY_SETS    |     1 |     8 |     1   (0)|
    |* 58 |           INDEX UNIQUE SCAN         | MTL_DEFAULT_CATEGORY_SETS_U1 |     1 |       |     0   (0)|
    |* 59 |          TABLE ACCESS BY INDEX ROWID| MTL_CATEGORIES_B             |     1 |    35 |     6   (0)|
    |* 60 |           INDEX RANGE SCAN          | MTL_CATEGORIES_B_N1          |    44 |       |     2   (0)|
    |* 61 |         TABLE ACCESS BY INDEX ROWID | MTL_ITEM_CATEGORIES          |    49 |   931 |    70   (0)|
    |* 62 |          INDEX RANGE SCAN           | MTL_ITEM_CATEGORIES_N3       |   441 |       |     4   (0)|
    |* 63 |        INDEX UNIQUE SCAN            | MTL_SYSTEM_ITEMS_B_U1        |     1 |     9 |     0   (0)|
    |  64 |   TABLE ACCESS BY INDEX ROWID       | MTL_SYSTEM_ITEMS_B           |     1 |    16 |     1   (0)|
    |* 65 |    INDEX UNIQUE SCAN                | MTL_SYSTEM_ITEMS_B_U1        |     1 |       |     0   (0)|
    ---------------------------------------------------------------------------------------------------------

  • Case statement resulting into Left outer join with other tables

    Hi All ,
    I am facing a stuation where a Case statement on one of the logical columns in Answers is resulting into a left outer join with a table in the query.
    If we remove the case stmt, the table is not being acessed.
    The case stmt is a simple one and no other logical column is being accessed in the case stmt.
    Please advice .
    Thanks.

    Hi Sai,
    No ..we dont have any left outer join ...its just that I am selecting measure from F1 which has a confimred dimension D1 with F2.Now when I dont have case stmt on measure from F1(Case stmt is something like : CASE WHEN "- P table"."P Column" = 'Y' THEN 'Right' ELSE 'Wrong' END), then it doesnt query F2.
    However as soon as I introduce the case stmt ,the query creates a left outer join with F2.
    Thanks.

  • Join with another table in pre-query

    Hi,
    We have a large data block and we need to order some columns based on street name for example, not id. The base table of db block contains an id_street column, and 'streets' table contains id and name.
    Ok, in pre-query trigger of that block, we have a complex logic and we dynamically build the where clause. At the end, we set the order_By clause of the block, to order the rows, for example we need to order by the 'my_date' column asc (it's a date type column), and street desc; but street NAME, not id. We don't want to use a from clause query, because the dynamically where clause logic it's complex.
    How can we join the db block table with 'streets' table in pre-query, so when constructing the order by clause to specify something like
    set_block_property('ADRESE_NEZONATE', order_by, 'my_date, name desc');where 'name' is the name of the street, from the 'streets' table.
    Is it possible in pre-query, somehow? Or, in my case where can I join with that table and use that column in pre-query at setting order by?
    Thanks!
    Edited by: Roger25 on 26.04.2013 12:31

    I understand what you say but partially.. please explain in more detail how to do that;
    How should look the adrese_nezonate block, then? I have to add a 'name' column and set copy value from item property to 'STREETS.NAME', and database_property No?
    Then the post-query trigger how should look like (the order by clause)? The post-query sends the entire query (with where/order by clauses) to the server, but in that "select... where... order by" (built dynamically) there are only columns from that block (adrese_nezonate). I need to join with streets, INSIDE that query.
    Thanks.

  • Maximum number of tables that can be outer joined with one table in a query

    Hi All,
    Iam new to sql, so can you please let me know What is the maximum number of tables that can be outer joined with one table in a query?
    Thanks,
    Srini

    srinu2 wrote:
    Iam new to sql, so can you please let me know What is the maximum number of tables that can be outer joined with one table in a query?
    There is no limit to the number of tables you can outer join as long as you join them correctly.
    SQL> with a as
      2      (
      3      select 1 id, 2 b_key, 3 c_key from dual union all
      4      select 2 id, 1 b_key, 4 c_key from dual union all
      5      select 3 id, 3 b_key, 1 c_key from dual union all
      6      select 4 id, 4 b_key, 2 c_key from dual
      7      ),
      8      b as
      9      (
    10      select 1 id, 1 c_key2 from dual union all
    11      select 2 id, 5 c_key2 from dual union all
    12      select 3 id, 3 c_key2 from dual union all
    13      select 4 id, 2 c_key2 from dual
    14      ),
    15      c as
    16      (
    17      select 1 key1, 1 key2, '1-1' dta from dual union all
    18      select 1 key1, 2 key2, '1-2' dta from dual union all
    19      select 1 key1, 3 key2, '1-3' dta from dual union all
    20      select 1 key1, 4 key2, '1-4' dta from dual union all
    21      select 2 key1, 1 key2, '2-1' dta from dual union all
    22      select 2 key1, 2 key2, '2-2' dta from dual union all
    23      select 2 key1, 3 key2, '2-3' dta from dual union all
    24      select 2 key1, 4 key2, '2-4' dta from dual union all
    25      select 3 key1, 1 key2, '3-1' dta from dual union all
    26      select 3 key1, 2 key2, '3-2' dta from dual union all
    27      select 3 key1, 3 key2, '3-3' dta from dual union all
    28      select 3 key1, 4 key2, '3-4' dta from dual union all
    29      select 4 key1, 1 key2, '4-1' dta from dual union all
    30      select 4 key1, 2 key2, '4-2' dta from dual union all
    31      select 4 key1, 3 key2, '4-3' dta from dual union all
    32      select 4 key1, 4 key2, '4-4' dta from dual
    33      )
    34  select d.a_id, d.b_id, c.key1 as c_key1, c.key2 as c_key3, c.dta
    35  from
    36      c,
    37      (
    38      select
    39          a.id as a_id, b.id as b_id, a.c_key, b.c_key2
    40      from a, b
    41      where a.b_key = b.id
    42      ) d
    43  where d.c_key = c.key1 (+)
    44  and   d.c_key2 = c.key2 (+);
          A_ID       B_ID     C_KEY1     C_KEY3 DTA
             3          3          1          3 1-3
             4          4          2          2 2-2
             2          1          4          1 4-1
             1          2
    SQL>

  • ANSI Standard Join with Nested Table

    Does anyone know how to (or whether you actually can) use ansi standard table joins with nested tables.
    Non-ansi standard would look something like this
    SELECT e.empno
    FROM departments d, TABLE(d.employees) e
    WHERE d.deptno = 10;
    Where d.employees is a nested table.
    But if I try ansi-standard I like such:
    SELECT e.empno
    FROM departments d
    JOIN TABLE(d.employees) e
    WHERE d.deptno = 10;
    I get
    ORA-00905: missing keyword
    because I have nothing to join it on.
    Your help is very much appreciated

    Both replies worked fine.
    I think I will go with the NATURAL JOIN as it seems the cleanest option.
    Thanks Guru 2748

  • Records getting multiplied  by a factor of 3 when joining with other table

    When i query a table association_1 records for a particular network element i get 7 records
    but join it with rtts_association table to get the rtts_no i m getting 21 records.....
    the problems is ... 7 records are getting multiplied by a factor of 3 resulting in 21 records ....
    how can i avoid these extra records that appear in the second query
    SQL> select raised,cleared from association_1 where ne ='30434000/1MU';
    RAISED               CLEARED
    03-FEB-2011 22:03:10 03-FEB-2011 22:06:15
    12-FEB-2011 06:27:18 12-FEB-2011 06:29:51
    21-FEB-2011 21:36:44 22-FEB-2011 10:23:06
    23-FEB-2011 01:08:44 23-FEB-2011 06:56:53
    23-FEB-2011 17:06:16 23-FEB-2011 19:55:19
    23-FEB-2011 20:37:22 23-FEB-2011 23:01:21
    24-FEB-2011 00:33:17 24-FEB-2011 02:03:26
    SQL> select a.raised,a.cleared,b.rtts from association_1 a, rtts_association b where a.ne=b.ne and a.ne='30434000/1MU';
    RAISED               CLEARED                    RTTS
    03-FEB-2011 22:03:10 03-FEB-2011 22:06:15    1490980
    03-FEB-2011 22:03:10 03-FEB-2011 22:06:15    1487697
    03-FEB-2011 22:03:10 03-FEB-2011 22:06:15    1487649
    12-FEB-2011 06:27:18 12-FEB-2011 06:29:51    1490980
    12-FEB-2011 06:27:18 12-FEB-2011 06:29:51    1487697
    12-FEB-2011 06:27:18 12-FEB-2011 06:29:51    1487649
    21-FEB-2011 21:36:44 22-FEB-2011 10:23:06    1490980
    21-FEB-2011 21:36:44 22-FEB-2011 10:23:06    1487697
    21-FEB-2011 21:36:44 22-FEB-2011 10:23:06    1487649
    23-FEB-2011 01:08:44 23-FEB-2011 06:56:53    1490980
    23-FEB-2011 01:08:44 23-FEB-2011 06:56:53    1487697
    RAISED               CLEARED                    RTTS
    23-FEB-2011 01:08:44 23-FEB-2011 06:56:53    1487649
    23-FEB-2011 17:06:16 23-FEB-2011 19:55:19    1490980
    23-FEB-2011 17:06:16 23-FEB-2011 19:55:19    1487697
    23-FEB-2011 17:06:16 23-FEB-2011 19:55:19    1487649
    23-FEB-2011 20:37:22 23-FEB-2011 23:01:21    1490980
    23-FEB-2011 20:37:22 23-FEB-2011 23:01:21    1487697
    23-FEB-2011 20:37:22 23-FEB-2011 23:01:21    1487649
    24-FEB-2011 00:33:17 24-FEB-2011 02:03:26    1490980
    24-FEB-2011 00:33:17 24-FEB-2011 02:03:26    1487697
    24-FEB-2011 00:33:17 24-FEB-2011 02:03:26    1487649
    21 rows selected.

    For every combination of raised & cleared columns in "association_1" table, there are 3 records in the "rtts_association" table with different values for "RTTS" as below:
    Association_1:
    RAISED               CLEARED
    03-FEB-2011 22:03:10 03-FEB-2011 22:06:15
    rtts_association
    03-FEB-2011 22:03:10 03-FEB-2011 22:06:15    1490980
    03-FEB-2011 22:03:10 03-FEB-2011 22:06:15    1487697
    03-FEB-2011 22:03:10 03-FEB-2011 22:06:15    1487649Hence, evidently you wil get 7 (association_1) * 3 (rtts_association) in your output. If you want only one record in the output, you may need to pick any one of the values of RTTS from the 3 different values based on a pre-defined condition (e.g. record corresponding to lowest or highest value of RTTS)
    Cheers --

  • How to avoid Duplicate Records  while joining two tables

    Hi,
    I am trying to join three tables, basically two tables are same one is like history table, so I wrote a query like
    select
    e.id,
    e.seqNo,
    e.name,
    d.resDate,
    d.details
    from employees e,
    ((select * from dept)union(select * from dept_hist)) d
    join on d.id=e.id and e.seqno=d.seqno
    but this returing duplicate records.
    Could anyone please tell me how to avoid duplicate records of this query.

    Actually it is like if the record is processed it will be moved to hist table, so both table will not have same records and I need the record from both the tables so i have done the union of both the tables, so d will have the union of both records.
    But I am getting duplicate records if even I am distinct.

  • OBIEE Conformed dimension with Bridge Table

    Hi,
    I have an issue and tried all the links from Mark and Gerad regarding bridge tables. But probably this is a bit different.
    I have to extend the OOB data model for OBIA - where the relationship between group account and gl account dimensions are 1 to many. In my case its many to many and hence bridge table.As this is not a standard customization, so posting this thread here.
    Although its out of the box, a short description of the scenario.
    Account Dimension levels -
    total --->Group account---->Gl account
    The logical table has two LTS - GL account and Group account forming a conformed dimension using column mapping.
    Earlier(OOB) there was no join the physical layer between these tables ,as I had to use the Bridge table , so I joined these two with the bridge table in physical layer.
    But the problem is, if I try to use standard technique to include the bridge table into the LTS of the group account table (i.e. Group account---->bridge<-------Gl account),
    there is a problem of over counting ,as the group account level is also connected to summary fact tables - the query will include the bridge table and hence over count.
    So my requirement is this -
    When only Group account is selected it will hit the summary fact tables (content level is already set in OOB), but it shouldn't use the bridge table - so no overcount.
    If we drill from Group account level or when Both Group account and Gl account is selected, it would use the bridge table and hit the detail fact table (content level is already set in OOB).
    I am using OBIA 7963 with OBIEE11g.
    This is the model - Summary facts <-------Group account ------>Bridge<-------Gl account-------->Detail Facts
    Please help.
    Regards,
    Krish
    Edited by: Krish on Aug 7, 2011 9:48 AM
    Edited by: Krish on Aug 7, 2011 9:50 AM

    Anybody please any i/p?

  • Self join with fact table in Obie 10G

    I am a newbie to obiee.I have a development requirement as follows-
    I need to find supervisors designation with the existing star RPD design. explanation is below
                                                        DIM_Designation(Desig_Wid)
                                                      |(Row_wid)
                                                      |
    DIM_EMPLOYEE--------WORKER_FACT------------DIM_Supervisor
    (Row_Wid)-----------------(Employee_Wid)
                                      (Supervisor_Wid)------------(Row_Wid)
    3 dimension is joined to fact to get employee, his supervisor and designation of employee. now i want to get the supervisor's designation? how is it possible? already employee and supervisor dimension is same W_employee_d table joined with fact as alias DIM_EMPLOYEE and DIM_SUPERVISOR. how to do self join with fact to get supervisor's designation. i do not have any supervisor_desig_wid in fact table. any help is deeply appreciated.

    Yes,Duplicate the fact table create a primary key on the newly fact table alias dimension table.So you can ur data modelling as usual.

  • INNER join with dynamic table name ?

    Hi,
    I have a problem with this statement.
    DATA: g_dso_bic_dofr TYPE tabname.
    SELECT t1~/bic/ziparomr
           t2~/bic/zifremom
    INTO (wa_rater_paromr-/bic/ziparomr,
           wa_rater_paromr-/bic/zifremom)
    *   FROM /bic/azd0bfr5100 AS t1     "equivalent to the dynamic statement below
    " this is the  problem
        FROM (g_dso_bic_dofr )AS t1
        INNER JOIN /bic/pzifremom AS t2
          ON t1~/bic/ziparomr = t2~/bic/ziparomr
    " --- to here
        WHERE t1~/bic/zikom     =  v_kommune
    The compile check doesnt work when i use the variable table name.
    I get
    "Wrong expression "INNER" in FROM clause. WHERE condition."
    Can anyone help me.
    Br Rasmus.

    " this is the  problem
    *    FROM (g_dso_bic_dofr )AS t1   "<<--- check spaces in here
        FROM (g_dso_bic_dofr) AS t1    "<<--- and here
        INNER JOIN /bic/pzifremom AS t2
          ON t1~/bic/ziparomr = t2~/bic/ziparomr
    " --- to here
    I think there's the problem, the space behind the parenthesis.
    Regards

  • Right way to preserve all parent table entries in a join with many tables!!

    This problem is quite interesting to me. I have asked this question to others but no body is able to provide me with proper answers.
    The problem is: How do I join a huge parent table with many child tables (more than 5 child tables) preserving all of the parent table entries. Lets say there is the parent table parentTable and three child tables childTable1, childTable2, childTable3. In order to get the data after joining these tables the query that I have been using was:
    select parent.field1, parent.field2, parent.field3, child1.field4, child1.field5, child2.field6, child3.field7 from ParentTable parent, childTable1 child1, childTable1 child2, childTable3 child3 where parent.fielda = child1.fieldb and parent.fieldc = child.fieldd and parent.fielde = child.fieldf.
    Although the tables are huge (more than 100,000 entries), this query is very fast, however those parent table entries which do not have child entries are lost. I know that I can left join a parent table with a child table and then with the next child table and then with the next child table and continue. Isn't there a simple solution for this commonly happening problem?
    Please provide suggestions please...

    Hello Lakshmi,
    Although I do not know exactly how to achieve what you want to achieve but I have seen DBAs/ABAPers in my experience can run queries/scripts using the COUNT function to give the actual number of line items per table for all your 100 or odd tables.
    Rgds
    CONMJI

  • Update Problem - Join With Another Table

    I'm trying to convert few MS Access Queries into Oracle. Following is one of the query from MS Access.
    <font face="courier">
    UPDATE [RESULT] INNER JOIN [MASTER]
        ON ([RESULT].[LAST_NAME] = [MASTER].[LAST_NAME])
       AND ([RESULT].[FIRST_NAME] = [MASTER].[FIRST_NAME])
       AND ([RESULT].[DOCUMENT_NUMBER] = [MASTER].[DOCUMENT_NUMBER])
       AND ([RESULT].[BATCH_ID] = [MASTER].[LEAD_ID])
    SET [MASTER].[CLOSURE_REASON] = "Closed For Name and Document Number Match",
        [MASTER].[RESULT_ID] = [RESULT].[ID],
        [MASTER].[RESULT_PID] = [RESULT].[PID]
    WHERE (([MASTER].[CLOSURE_REASON] Is Null)
       AND ([MASTER].[REC_CODE] = "A1")
       AND ([RESULT].[EVENT_DATE] = [MASTER].[EVENT_DATE])
       AND ([RESULT].[EVENT_TYPE] = "Open")
       AND ([MASTER].[DOCUMENT_NUMBER] Is Not Null)
       AND ([MASTER].[DOCUMENT_NUMBER)] "null"));
    </font>
    First I received ORA-01779: cannot modify a column which maps to a non key-preserved table Error. I followed different examples (including MERGE) from your
    site and modified my original query. Now, I receive ORA-30926: unable to get a stable set of rows in the source tables Error.
    Most of the examples showed only one join between the tables but I have to make more joins based on my requirements.
    Any help translating this query in to Oracle would be Great. Thanks!

    Assuming that the columns you are joining to in the result table are the whole PK or are declared as aunique contraint (i.e. some combination of last_name, first_name, document_number, batch_id, event_date, id, and pid make up the entire PK/unique constraint), then the updateable join view should look something like:
    update (select m.last_name, m.first_name, m.document_number, m.lead_id,
                   m.closure_reason, m.result_id, r.id, m.result_pid, r.pid
            from master m
               join result r
                  on r.last_name = m.last_name and
                     r.first_name = m.first_name and
                     r.document_number = m.document_number and
                     r.batch_id = m.lead_id and
                     r.event_date = m.event_date
            where m.closure_reason is null and
                  m.rec_code = 'A1' and
                  r.event_type = 'Open' and
                  m.document_number is not null and
                  m.document_number != 'null')
    set closure_reason = 'Closed For Name and Document Number Match',
        result_id = id,
        result_pid = pidThe merge version would look something like:
    merge into master
       using (select last_name, first_name, document_number, batch_id,
                     event_date, id, pid
              from result
              where event_type = 'Open') r
       on (r.last_name = m.last_name and
           r.first_name = m.first_name and
           r.document_number = m.document_number and
           r.batch_id = m.lead_id and
           r.event_date = m.event_date)
       when mathed then
          update
          set closure_reason = 'Closed For Name and Document Number Match',
              result_id = id,
              result_pid = pid
          where m.closure_reason is null and
                m.rec_code = 'A1' and
                m.document_number is not null and
                m.document_number != 'null';However, as Hoek pointed out, the combination of last_name, first_name, document_number, batch_id, event_date, id, and pid must point to a unique row in the result table, whether they make up the PK or a unique constraint. If there are, or could be, multiple rows for a particular combination of last_name, first_name, document_number, batch_id, event_date, id, and pid, then you will need to find a way to determine which of those rows should be used to do the update.
    John

  • Avoid duplicates when importing with Home Sharing?

    I have an iMac which hosts my iTunes library.  I have home sharing turned on so everyone else in the family (both on the iMac and on laptops) play things at home from that library.
    But for when I'm not at home, I like to use the import feature to put local copies of music or movies on my macbook pro (local) iTunes library.  The problem I run into is if I inadvertently import a song I already imported once before, I'll end up with two copies of the song.  This happens if I want to just import a whole new playlist that contains songs I happen to already have locally.  Instead of just over-writing the existing file (which is what I want it to do), it imports another copy of the song into the same folder with a "-1" appended to the filename.
    Finally the question:  is there a way to make iTunes not create duplicates of songs?  Ideally it the import function should be skipping over songs that already exist, but an alternatively acceptable behavior would be to just over-write the existing files.
    Thanks

    Are you importing from a camera or the Finder. I don't import from a camera so can't comment on that method but importing from the Finder does give you the prompt.
    If you don't get the prompt with either method close iPhoto, delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your Home/Library/Preferences folder, launch iPhoto and try again.
    NOTE: If you're moved your library from its default location in your Home/Pictures folder you will have to point iPhoto to its new location when you next open iPhoto by holding the the Option key. You'll also have to reset the iPhoto's various preferences.

Maybe you are looking for

  • Adobe Acrobat Reader displaying boxes in place of dashes

    My company is having an issue with Word documents that have dashes and are converted to PDF.  On the resulting PDF when viewed with Acrobat Reader, the dashes are being displayed as boxes instead of dashes.  This is causing an issue with an OCR appli

  • Aktiverung CS2 occassion

    Weder telefonisch noch über das Internet ist es möglich, meine kürzlich erworbene Adobe CS2 zu aktivieren. Es ist echt unmöglich mit jemanden das Problem anzuschauen. Was muss ich tun, wo und wie kann ich die Software aktivieren lassen?

  • Communication Failure With HP Officejet J6480 All-In-One

    I bought a new printer, an HP Officejet J6480 All-In-One, and set it up with my PC. Then, I set it up with my mac. I get this error: "Communication Failure: The computer is no longer able to communicate with your printer. Turn the printer off, check

  • Help needed reg this code

    & Include MZFBPS_TRREQTOP                                   Module poo PROGRAM  SAPMZFBPS_TRREQ . tables : ZFBPS_TRPTR_REQ,          ZFBPS_CONT_HD,          ZFBPS_CONT_DT. data:     OK_CODE like sy-ucomm,           save_ok(4). data : it_gate like sta

  • Pc Suite cannot connect mine 2630?

    How to connect nokia2630 by bluetooth to pc suite. It does not show mine phone . I used IVT software. Please help?