Pivot + cross join

Hello,
I've written the following query, which works fine:
select * from
     select
          to_char(SCB_OPENTIME, 'YYYY-MM') as curr_date,
          SCB_TASK
     from EM_DATA_MSR_SC
pivot
     count(SCB_TASK) for curr_date in
          '2011-01',
          '2011-02',
          '2011-03',
          '2011-04',
          '2011-05',
          '2011-06',
          '2011-07',
          '2011-08',
          '2011-09',
          '2011-10',
          '2011-11',
          '2011-12'
);Now I need to apply a cross join on it:
select * from
     select
          to_char(SCB_OPENTIME, 'YYYY-MM') as curr_date,
          SCB_TASK
     from EM_DATA_MSR_SC
     where
          EMSCG_STATUS = status.name
pivot
     count(SCB_TASK) for curr_date in
          '2011-01',
          '2011-02',
          '2011-03',
          '2011-04',
          '2011-05',
          '2011-06',
          '2011-07',
          '2011-08',
          '2011-09',
          '2011-10',
          '2011-11',
          '2011-12'
cross join
    select 0, 'Closed' as name from DUAL union
    select 1, 'Denied' from DUAL union
    select 2, 'Open' from DUAL
) status;When I try to execute this query, I get this error message:
"STATUS"."NAME": invalid identifierHowever, SQL is supposed to have table references scoped to one level deep.
Am I doing something wrong?

Unfortunately, your snippet doesn't work either.
Here is a simple test case:
CREATE TABLE TEST
  NUM NUMBER NOT NULL,
  DAT DATE NOT NULL
insert into TEST (NUM, DAT) values (32, SYSDATE - 43);
insert into TEST (NUM, DAT) values (9, SYSDATE - 143);
insert into TEST (NUM, DAT) values (90, SYSDATE - 13);
insert into TEST (NUM, DAT) values (24, SYSDATE - 3);
insert into TEST (NUM, DAT) values (244, SYSDATE - 39);
insert into TEST (NUM, DAT) values (44, SYSDATE - 9);
insert into TEST (NUM, DAT) values (44, SYSDATE - 9);
insert into TEST (NUM, DAT) values (44, SYSDATE - 9);
insert into TEST (NUM, DAT) values (60, SYSDATE - 9);
insert into TEST (NUM, DAT) values (51, SYSDATE - 9);
insert into TEST (NUM, DAT) values (44, SYSDATE - 9);
insert into TEST (NUM, DAT) values (0, SYSDATE - 3);
insert into TEST (NUM, DAT) values (16, SYSDATE - 11);
insert into TEST (NUM, DAT) values (24, SYSDATE - 9);
insert into TEST (NUM, DAT) values (59, SYSDATE - 27);
insert into TEST (NUM, DAT) values (29, SYSDATE - 16);
insert into TEST (NUM, DAT) values (20, SYSDATE - 47);
insert into TEST (NUM, DAT) values (103, SYSDATE - 1);
insert into TEST (NUM, DAT) values (41, SYSDATE - 92);
insert into TEST (NUM, DAT) values (42, SYSDATE - 40);Here's the corresponding working query:
select * from
     select
          to_char(DAT, 'YYYY-MM') as curr_date,
          NUM
     from TEST
pivot
     count(NUM) for curr_date in
          '2011-01',
          '2011-02',
          '2011-03',
          '2011-04',
          '2011-05',
          '2011-06',
          '2011-07',
          '2011-08',
          '2011-09',
          '2011-10',
          '2011-11',
          '2011-12'
;Now, say I want to display the number of NUMs grouped by range values and by DAT. I'd like to have this kind of output (each # is a different number):
-------- 2011-01 2011-02 2011-03 2011-04 2011-05 2011-06 2011-07 2011-08 2011-09 2011-10 2011-11 2011-12
0 - 20         #       #       #       #       #       #       #       #       #       #       #       #
21 - 50        #       #       #       #       #       #       #       #       #       #       #       #
51 - 300       #       #       #       #       #       #       #       #       #       #       #       #To do so, I'd like to write something like this:
select * from
     select
          to_char(DAT, 'YYYY-MM') as curr_date,
          NUM
     from TEST
     where NUM >= ranges.mini and NUM <= ranges.maxi
pivot
     count(NUM) for curr_date in
          '2011-01',
          '2011-02',
          '2011-03',
          '2011-04',
          '2011-05',
          '2011-06',
          '2011-07',
          '2011-08',
          '2011-09',
          '2011-10',
          '2011-11',
          '2011-12'
cross join
    select 0, 0 as mini, 20 as maxi from DUAL union
    select 1, 21, 50 from DUAL union
    select 2, 51, 300 from DUAL
) ranges
;Alas, this isn't a valid query:
"RANGES"."MAXI": invalid identifierUsing a WITH clause doesn't help (same error message):
with ranges as
    select 0, 0 as mini, 20 as maxi from DUAL union
    select 1, 21, 50 from DUAL union
    select 2, 51, 300 from DUAL
select * from
     select
          to_char(DAT, 'YYYY-MM') as curr_date,
          NUM
     from TEST
     where NUM >= ranges.mini and NUM <= ranges.maxi
pivot
     count(NUM) for curr_date in
          '2011-01',
          '2011-02',
          '2011-03',
          '2011-04',
          '2011-05',
          '2011-06',
          '2011-07',
          '2011-08',
          '2011-09',
          '2011-10',
          '2011-11',
          '2011-12'
cross join ranges
;EDIT:
Always say which version of Oracle you're using.Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
"CORE     11.1.0.7.0     Production"
TNS for Solaris: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
EDIT 2:
SCB_TASK replaced by NUM in queries
Edited by: 895536 on 7 nov. 2011 09:01

Similar Messages

  • Cross Join or Cartesian Product

    Hi Expert,
    I'm not sure if I'm posting in the right place, because this problem involve between BW/BEx, Universe and BO; but I think there's a possibility 'a wrong' in the universe.
    Right now I want to create a report in Webi from BEx Query via Universe.
    When I put 2 query item in Webi, let's say, PERNR and TRFST. The result looks like this (example) :
    PERNR         TRFST
    12345            S1
    12345            S2
    54321            S1
    54321            S2
    Ok, that's the appetizer. Here's the main course.
    For some reason, I'm using function module in ABAB to create a data source table as transaction data in BW. I create a Fact Table that contain all field that I need to create dimension tables. This, in my opinion, for eliminate the possibility that the cross join appear because there's something wrong in the relationship between the dimension and the fact when creating the cube. This is a little example of my Cube result :
    PERNR        TRFST        KEY FIGURE
    12345            S1            XXX
    54321            S2            ZZZ
    As I explain above, I create Person dimension and TRFST (in my case I called 'Eselon') dimension and 1 Key Figure. So, from here, I assumed that there's no problem with the BW because the cube resulted the content as I'm expected.
    Then I moved to BEx designer. I create a query from that cube, creating a pivot table that contain Person, Eselon, and the key figure. When I open the query in the BEx Analysis, the excel create a pivot table like this :
                           KEY FIGURE
    12345    S1       XXX
    Result               XXX
    54321    S2      ZZZ
    Result               ZZZ
    From here, again I assumed, there's no problem in BEx, since there's no cross join between the dimension. Then I create the universe, then I tried to create the Webi report, and DANG!! a cross join appear.
    Did you guys have any idea or solution about this? This is for the first time I created a universe using BEx, so maybe I miss something.
    I will appreciate every helpful comment from you
    Thank You
    Rully

    Well.. ummm.. actually I don't using 2 query nor 2 data provider for my report. It came from 1 query. But that's ok. It's just misunderstanding between us. Maybe because I'm using the '2 query item' word. I'm sorry.
    Just for your information, finally I can solve it. Like I said in the first post, I'm just trying to use 2 characteristic (I think this is better word rather than query item), but I don't pull the key figures to the report. When I put at least 1 key figure to the report, pam pam pa ra pam... the cross join gone. I don't know why, but it happen.
    Than, I examine this case by creating a simple report using eFashion universe. When I put 2 characteristic without key figure, there's no cross join. I don't know why, but it happen.
    well, thank you for your comment, even mostly there are misunderstanding, but I really appreciate it. Thank you.
    Rully

  • [8i] Need help with full outer join combined with a cross-join....

    I can't figure out how to combine a full outer join with another type of join ... is this possible?
    Here's some create table and insert statements for some basic sample data:
    CREATE TABLE     my_tab1
    (     record_id     NUMBER     NOT NULL     
    ,     workstation     VARCHAR2(4)
    ,     my_value     NUMBER
         CONSTRAINT my_tab1_pk PRIMARY KEY (record_id)
    INSERT INTO     my_tab1
    VALUES(1,'ABCD',10);
    INSERT INTO     my_tab1
    VALUES(2,'ABCD',15);
    INSERT INTO     my_tab1
    VALUES(3,'ABCD',5);
    INSERT INTO     my_tab1
    VALUES(4,'A123',5);
    INSERT INTO     my_tab1
    VALUES(5,'A123',10);
    INSERT INTO     my_tab1
    VALUES(6,'A123',20);
    INSERT INTO     my_tab1
    VALUES(7,'????',5);
    CREATE TABLE     my_tab2
    (     workstation     VARCHAR2(4)
    ,     wkstn_name     VARCHAR2(20)
         CONSTRAINT my_tab2_pk PRIMARY KEY (workstation)
    INSERT INTO     my_tab2
    VALUES('ABCD','WKSTN 1');
    INSERT INTO     my_tab2
    VALUES('A123','WKSTN 2');
    INSERT INTO     my_tab2
    VALUES('B456','WKSTN 3');
    CREATE TABLE     my_tab3
    (     my_nbr1     NUMBER
    ,     my_nbr2     NUMBER
    INSERT INTO     my_tab3
    VALUES(1,2);
    INSERT INTO     my_tab3
    VALUES(2,3);
    INSERT INTO     my_tab3
    VALUES(3,4);And, the results I want to get:
    workstation     sum(my_value)     wkstn_name     my_nbr1     my_nbr2
    ABCD          30          WKSTN 1          1     2
    ABCD          30          WKSTN 1          2     3
    ABCD          30          WKSTN 1          3     4
    A123          35          WKSTN 2          1     2
    A123          35          WKSTN 2          2     3
    A123          35          WKSTN 2          3     4
    B456          0          WKSTN 3          1     2
    B456          0          WKSTN 3          2     3
    B456          0          WKSTN 3          3     4
    ????          5          NULL          1     2
    ????          5          NULL          2     3
    ????          5          NULL          3     4I've tried a number of different things, googled my problem, and no luck yet...
    SELECT     t1.workstation
    ,     SUM(t1.my_value)
    ,     t2.wkstn_name
    ,     t3.my_nbr1
    ,     t3.my_nbr2
    FROM     my_tab1 t1
    ,     my_tab2 t2
    ,     my_tab3 t3
    ...So, what I want is a full outer join of t1 and t2 on workstation, and a cross-join of that with t3. I'm wondering if I can't find any examples of this online because it's not possible....
    Note: I'm stuck dealing with Oracle 8i
    Thanks!!

    Hi,
    The query I posted yesterday is a little more complicated than it needs to be.
    Since my_tab2.workstation is unique, there's no reason to do a separate sub-query like mt1; we can join my_tab1 to my_tab2 and get the SUM all in one sub-query.
    SELECT       foj.workstation
    ,       foj.sum_my_value
    ,       foj.wkstn_name
    ,       mt3.my_nbr1
    ,       mt3.my_nbr2
    FROM       (     -- Begin in-line view foj for full outer join
              SELECT        mt1.workstation
              ,        SUM (mt1.my_value)     AS sum_my_value
              ,        mt2.wkstn_name
              FROM        my_tab1   mt1
              ,        my_tab2   mt2
              WHERE        mt1.workstation     = mt2.workstation (+)
              GROUP BY   mt1.workstation
              ,        mt2.wkstn_name
                    UNION ALL
              SELECT      workstation
              ,      0      AS sum_my_value
              ,      wkstn_name
              FROM      my_tab2
              WHERE      workstation     NOT IN (     -- Begin NOT IN sub-query
                                               SELECT      workstation
                                       FROM      my_tab1
                                       WHERE      workstation     IS NOT NULL
                                     )     -- End NOT IN sub-query
           ) foj     -- End in-line view foj for full outer join
    ,       my_tab3  mt3
    ORDER BY  foj.wkstn_name
    ,       foj.workstation
    ,       mt3.my_nbr1
    ,       mt3.my_nbr2
    ;Thanks for posting the CREATE TABLE and INSERT statements, as well as the very clear desired results!
    user11033437 wrote:
    ... So, what I want is a full outer join of t1 and t2 on workstation, and a cross-join of that with t3. That it, exactly!
    The tricky part is how and when to get SUM (my_value). You might approach this by figuring out exactly what my_tab3 has to be cross-joined to; that is, exactly what should the result set of the full outer join between my_tab1 and my_tab2 look like. To do that, take your desired results, remove the columns that do not come from the full outer join, and remove the duplicate rows. You'll get:
    workstation     sum(my_value)     wkstn_name
    ABCD          30          WKSTN 1          
    A123          35          WKSTN 2          
    B456          0          WKSTN 3          
    ????          5          NULL          So the core of the problem is how to get these results from my_tab1 and my_tab2, which is done in sub-query foj above.
    I tried to use self-documenting names in my code. I hope you can understand it.
    I could spend hours explaining different parts of this query in more detail, but I'm sure I'd waste some of that time explaining things you already understand. If you want an explanation of somthing(s) specific, let me know.

  • Illegal cross join within the same dimension caused by incorrect subject ar

    hi!
    Imagine the following BMM:
    There is one Logical Dimension Table "Service Account" with the following LTS:
    - LTS "D_SERVICE"
    - LTS "D_SERVICE_CLASS"
    - LTS "D_SERVICE_STATUS"
    This Logical Tabe "Service Account" joins (One-to-many) with several Fact Tables (other Logical Tables).
    In the Physical Layer the joins for the "Service Account" LTS are:
    - One-to-many between D_SERVICE_CLASS and D_SERVICE
    - One-to-many between D_SERVICE_STATUS and D_SERVICE
    The problem is that when I build a report in Answers using only the following columns of the Logical Table "Service Account":
    - Service Class Desc (which exists in the Logical Table "Service Account" and in the Physical Table D_SERVICE_CLASS)
    - Service Status Desc (which exists in the Logical Table "Service Account" and in the Physical Tabl D_SERVICE_STATUS)
    - MSISDN (which existis in the Logical Table "Service Account" and in the Phsyical Table D_SERVICE)
    the following error appears:
    Estado: HY000. Código: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 14065] Illegal cross join within the same dimension caused by incorrect subject area setup: [ (select * from prd.D_SERVICE where SOURCE_SYS in ('ARBOR','PPB') and DW_SERV_ST_ID in (100000003,100000009)) as T1836, D_SERVICE_CLASS T1916] with [ D_SERVICE_STATUS T1948] (HY000)
    SQL emitido: SELECT "SERVICE ACCOUNT"."TLC MSISDN9" saw_0, "SERVICE ACCOUNT"."IWS Service Class Desc" saw_1, "SERVICE ACCOUNT"."TLC Service Status Desc" saw_2 FROM "VFPT - Upgrade Siebel" WHERE "SERVICE ACCOUNT"."TLC MSISDN9" = '917330340' ORDER BY saw_0, saw_1, saw_2
    Help, please!
    Thanks.

    Physically, only D_SERVICE is joined to the facts. Then D_SERVICE_CLASS is joined to D_SERVICE (one-to-many) and D_SERVICE_STATUS is joined also to D_SERVICE (one-to-many).
    In the BMM, there is only one Logical Dimension Table for those 3 physical tables. This Logical Dimension Table is called "Service Account" and has 3 LTS: D_SERVICE, D_SERVICE_CLASS, D_SERVICE_STATUS. The Logical Dimension Table has several logical columns that are associated to those 3 LTS: SERVICE_KEY, SERVICE_CLASS_KEY, SERVICE_STATUS_KEY, SERVICE_MSISDN, SERVICE_CLASS_DESC, SERVICE_STATUS_DESC.
    The Logical Dimension Table "Service Account" is then joined to a fact table (one-to-many).
    I didn't understand the suggestion about the 3 LTS... Aren't we doing that already? Can you explain it better, please?
    thanks.

  • OBIEE: non empty cross join function problem with some reports

    Hi all,
    I am getting some problem ,when we are excuting some requests in OBIEE its taking long time , Actually our OBIEE is connected with Essbase when we are generating some reports its taking long time so i captured the Query in OBIEE and Iam excuting that query in Essbase MDX editor
    its having the the function " NON EMPTy CROSS JOIN"
    which reports having non empty crossjoin function its taking long time so how can i disable this function in OBIEEfor that reports
    I dont want to use that function for my reports so how can i do this in OBIEE
    your help would be appriciated.
    Thanks
    Edited by: user8815661 on 26 mai 2010 08:44

    Any Help

  • How to avoid duplicates in CROSS JOIN Query

    Hi,
    I am using CROSS JOIN to get all the subset of a table col values as shown below:
    PRODUCT (Col Header)
    Bag
    Plate
    Biscuit
    While doing cross join we will get as
    Bag Bag
    Bag Plate
    Bag Biscuit
    Plate Bag
    Plate Plate
    Plate Biscuit ..... like this
    By placing where condition prod1 <> prod2 to avoid Bag Bag and Plate Plate values. So the output will be like below
    Bag Plate
    Bag Biscuit
    Plate Bag
    Plate Biscuit
    Now "Bag Plate" and "Plage Bag" are same combination how to avoid these records. My expected result is
    Bag Biscuit
    Plate Biscuit
    How to derive this ?
    Sridhar

    Hi,
    This is the the solution that I found as fit to the OP question, but
    Visakh16 already posted the same idea (assuming the names are unique) from the start and I don't think that anyone notice it!
    Sridhar.DPM did
    you check Visakh16's response
    (the second response received)?!?
    I will mark his response as an answer. If this is not what you need pls clarify and you can unmark it :-)
    [Personal Site] [Blog] [Facebook]

  • How to resolve illegal cross join error

    Can someone please tell me how can we avoid illegal cross join error in modeling? If someone has any reference document , please share it.
    I have 5 tables - Dim (A, B , C,E) and Fact( D). C is lookup table which is used to resolve the lookup code column in table E.
    The relationships between these are
    A--< B--< E >--C
    & A--<D
    My requirement is i have to expose Attributes of A,B ,C & E within Dimension.
    These attributes (from B,C,E) will be treated as property of A.
    Someone may query these attributes without selecting any column from fact table.
    Thanks & Regards,
    Ashish

    Hi Ashish,
    it's not the first time you come up with this kind of question and I'm wondering if you understand the principle of granularity when I read your questions.
    On physical level, a fact table must always join with the lowest level of detail of your dimension table. Let me explain, by giving an example which looks like your situation.
    Assume I have three tables:
    Table "E" contains products, which has attributes like: product_id and product_name
    Table "B" contains order line items, which has attributes like: order_line_item_id, order_id and product_id.
    Table "A" contains orders, which has attributes like: order_id and customer_name.
    Table "D" contains facts ("metrical data") about my order: which has attributes like: order_id, order_revenue.
    This will be the diagram on physical level: E--<B--<A--<D
    Here are my joins: E.product_id on B.produc_id, B.order_id on A.order_id, A.order_id--<D.order_id
    Now, my question to you is: will I be able to get the revenue of a certain product?
    The answer is: No, because I don't know what part of my order is spent on a certain product. The problem is thus that the data in the fact table isn't stored on that level of detail, or in other words the fact and dimension table don't share the same level of granularity.
    How it should be:
    If you want to get the revenue per product, you will need to have a second fact table "G", which has data which is stored on order line item level. This table contains the following attributes: order_line_item_id, product_id and order_line_item_revenue.
    This will become your diagram on physical level:
    B--<G>--E
    Joins: B.order_line_item_id on G.order_line_item_id and E.product_id on G.product_id
    Table E has become a dimension of fact table G.
    The first physical diagram should look like this:
    A--<D
    If you want you can model both physical diagrams into one logical diagram, assuming that A and D (order dimension and fact table) are aggregates of B and G (order line items dimension and fact table). In that case you should read this blog item: http://obiee101.blogspot.com/2008/11/obiee-making-it-aggregate-aware.html
    Regards,
    Stijn

  • Cross join of dimensions

    Hi,
    For example:  two dimension tables and one fact table.
    dim1: branch
    branch1
    branch2
    dim2: time
    day1
    day2
    fact: sales
    branch1, day2, 100
    what I want in answers when using branch and time and sales without any filters:
    Branch1, day1, 0
    branch1, day 2, 100
    Branch 2, day1, 0
    Branch 2, day 2, 0
    so basically I want to keep all dimensions combinations and related facts or 0 if there is no related facts. How to do it?
    I know how to do it for just one dimension.  That is to set up the relationship between the dimension and the fact as outer join. But how about two or more dimensions?
    In SQL it will be something like dimension 1 cross join dimension 2 then left outer join the fact.  How to do it in OBIEE 10 G?

    And I have tried set branch - fact and time - fact as outer join. In answers,
    1. select time and sales
    day1, null
    day2, 100
    2. select branch and sales
    branch1, 100
    branch2, null
    3. select branch, time , and sales
    branch 1, day 2, 100
    branch 2, null, null

  • [nQSError: 14065] Illegal cross join

    I am getting the following the following error “[nQSError: 14065] Illegal cross join” in the following situation.
    We have one dimension table Called “WC_CUSTOMER_D” and in that table we are storing 2 row_wids one to store the “Status Wid” (data comes from WC_LOV_D) and “Risk Wid” (again data comes from WC_LOV_D) of the customer . We have 2 alias table as Dim_Status_WC_LOV_D and Dim_Risk_WC_LOV_D and it joins to the Dim_WC_CUSTOMER_D .
    In Logical we have one Logical table “Dim Customer” and has 3 Logical table source (reason is we can write content level filters ) for the each dimension tables. We exposed some attributes from the Dim_WC_CUSTOMER_D, Dim_status_WC_LOV_D and Dim_Risk_WC_LOV_D tables.
    In answer , We are getting the illegal cross join error when we expose fields from 2 WC_LOV_D alias tables
    Error comes only if we use alias of same physical type more than once
    Query Status: Query Failed: [nQSError: 14065] Illegal cross join within the same dimension caused by incorrect subject area setup: [
    WC_CUSTOMER_D T624599,
    WC_LOV_D T624699] with [
    WC_LOV_D T628734]
    But when I add a fact , BI is able to build a query
    select T624599.SOURCE_SYSTEM as c1,
    T624699.LOOKUP_CODE as c2,
    T628734.LOOKUP_CODE as c3,
    count(distinct T623979.CUST_ACCT_WID) as c4
    from
    WC_LOV_D T628734 /* Dim_Risk_WC_LOV_D_ */ ,
    WC_LOV_D T624699 /* Dim_Staus_WC_LOV_D */ ,
    WC_CUSTOMER_D T624599 /* Dim_W_CUSTOMER_D */ ,
    WC_CUSTOMER_F T623979 /* Fact_WC_CUSTOMER_F */
    where ( T623979.CUST_FIN_PROFL_WID = T624599.ROW_WID and T624599.X_ACCOUNT_STATUS_WID = T624699.ROW_WID and T624599.X_RISK_CODE_WID = T628734.ROW_WID and T628734.LOOKUP_TYPE = 'RISK' and T624699.LOOKUP_TYPE = 'STATUS' )
    group by T624599.X_ SOURCE_SYSTEM, T628734.LOOKUP_CODE, T624699.LOOKUP_CODE
    order by c1, c2, c3
    Please guide me if I did some mistake or any work around for this issue.
    Thanks
    Barna

    Hi,
    Maybe you have already resolved this issue. In any case, I found a solution following instructions in support note ID 1329237.1.
    Best regards,
    Cristina

  • [nQSError: 14065] Illegal cross join within the same dimension

    Hey guys,
    I'm stumped. I have two dimension tables that are joined 1:N (there is NOT an M:N relationship between them) and I have them joined in the Physical Layer and the Business Model and Mapping Layer. The two tables are F4101 (the "1") and F4102 (the "N") in the 1:N relationship. F4102 then joins to a fact table, and F4101 joins to NOTHING else. So I don't believe I have a circular condition or a need for a bridge table. Both tables are published to the Presentation Layer for reporting.
    The error occurs in Answers when I want to do something as trivial as display the three primary key columns together from F4101: F4101.col1, F4101.col2, F4101.col3 (all three make up the PK). When I do that, the following error occurs:
    "nQSError: 14065] Illegal cross join within the same dimension caused by incorrect subject area setup: [ F4101 T28761] with [ F4102 T1805] "
    What I can't figure out is WHY the F4102 table is listed in this error. I didn't try to report on it at all. See the logical SQL below from my query:
    "SQL Issued: SELECT "Item Master (F4101)".IMITM saw_0, "Item Master (F4101)".IMLITM saw_1, "Item Master (F4101)".IMAITM saw_2 FROM "Sales Analysis" ORDER BY saw_0, saw_1, saw_2"
    As soon as I take out one of the three PK columns and add in another non-PK column from F4101, it works just fine. And reporting on each of the three PK columns individually works as well in Answers.
    Any ideas? I would greatly appreciate it.
    Thanks.

    Try this;
    1. In the logical layer, create one folder called F4101_F4102.
    2. Map both F4101 and F4102 as logical table sources in that folder.
    3. Join from the folder F4101_F4102 to the fact using a Logical (new complex join) join.
    Chris.

  • Cross Join in ABAP Open SQL

    Hi guys!
    I need to implement a CROSS JOIN (cartesian product) based on two tables. To my understanding there is no construct to implement a cross join in OPEN SQL. So the question is first is this correct? And secondly in which way would you then implement a cross join of two tables with the constructs at hand in ABAP?
    I have come up with the following solution of cross joining two tables, but would like to know if there is a better (not so ugly way).
    Example:
    SELECT * FROM tab1 AS t1 JOIN tab2 AS t2 ON t1mandt = t2mandt INTO CORRESPONDING FIELDS OF itab.
    Note that this only works if the tables tab1 and tab2 is client dependent.
    Regards,
    Christian

    Christian,
      There's no cross join construct in abap. Join statement results in a cartesin product rarely because of completely obsolete statistics missing selection or join conditions.
    Try the following join to get result similar to cartesian product
    select tab1location tab2matnr into itab
      from tab1 join tab2 on tab1location ne tab2matnr.
    if you really want to implement cross join, use native sql, try the following code,
    beware of cartesian products, Basis folks doesn't like em....
    data: begin of itab occurs 0,
      loc like tab1-sloc
      matnr like tab2-matnr,
    end of itab.
    exec sql performing append_itab.
      select a.loc, b.matnr
        into :itab
        from tab1 a
        cross join tab2 b
    endexec.
    form append_itab.
      append itab.
    endform.               
    Regards
    Sridhar.

  • Error occurred when executing query involving cross join or outer join

    Hi,
    I tried to execute the following query:
    select count(*)
    from
         po,
         invoice,
         table(xmlsequence(extract(invoice.content, '/CommercialInvoice/Body/LineItemDetails/LineItem'))) invoice_line_item
    where
         extractValue(po.content, '/PurchaseOrder/Header/DocumentID/RID') =
         extractValue(value(invoice_line_item), '/LineItem/Product/PurchaseOrderIdentifier/documentCreatorIdentifier')(+)
    It produced the following error:
         Error: ORA-00936: missing expression
    Then I change the query to:
    select count(*)
    from
         po left outer join
              invoice cross join
              table(xmlsequence(extract(invoice.content, '/CommercialInvoice/Body/LineItemDetails/LineItem'))) invoice_line_item
         on
              extractValue(po.content, '/PurchaseOrder/Header/DocumentID/RID')
              = extractValue(value(invoice_line_item), '/LineItem/Product/PurchaseOrderIdentifier/documentCreatorIdentifier')
    It produced the following error:
         Error: ORA-00904: "INVOICE"."SYS_NC0012900130$": invalid identifier
    If I simply the query to:
    select 1
    from
         invoice cross join
         table(xmlsequence(extract(invoice.content, '/CommercialInvoice/Body/LineItemDetails/LineItem'))) invoice_line_item
    It also produced the following error:
         Error: ORA-00904: "INVOICE"."SYS_NC0012900130$": invalid identifier
    What is the cause of the problem? How to resolve it?
    The version I am using is 10.1.0.2.0 on Windows. Any help would be much appreciated.

    Hi,
        Recently we went for BW upgradatiaon (BI7.0) , the error you are facing could be due to the following issue,
        If infoobjects are used in infoset as infoprovider ( in BW3.5) after upgrade this infoobjects will not be selected automatically as infoproviders. So it will not be available for Infoset.
    Please check whether any infoobjects are used as infoprovider, if so manually change them as infoprovider ( In BI7) and activate.
    Since, few reports are working on the infoset , this could be those reports are not using the fields from the infoobjects. so it is working it seems.
    Please check and let me know.
    Thanks,
    V.Senthil

  • CONNECT BY with CROSS JOIN and WHERE not executing as described in doc

    Hello all,
    please see these two statements. They are the same, but the 1st uses t1 INNER JOIN t2 while the snd uses a CROSS JOIN with WHERE.
    The 2nd statement shows one row more than the first, but the CROSS JOIN with WHERE is the same as the INNER JOIN.
    The result would be OK if Oracle did:
    JOIN -> CONNECT BY PRIOR -> WHERE
    But according to the docs it does:
    JOIN (and WHEREs for JOINS) -> CONNECT BY PRIOR -> Rest of WHERE
    See http://docs.oracle.com/cd/E11882_01/server.112/e26088/queries003.htm#SQLRF52332 for details. There it says:
    Oracle processes hierarchical queries as follows:
    A join, if present, is evaluated first, whether the join is specified in the FROM clause or with WHERE clause predicates.
    The CONNECT BY condition is evaluated.
    Any remaining WHERE clause predicates are evaluated.
    +.....+
    Is this a bug? I'd say yes, because it differs from the docs and it also is not what people are used to ("a,b WHERE" is the same as "a INNER JOIN b").
    Thanks,
    Blama
    --Statement 1:
    WITH t1
    AS
    (SELECT 1 a, 2 b FROM DUAL UNION ALL
    SELECT 2 a, 3 b FROM DUAL UNION ALL
    SELECT 3 a, 4 b FROM DUAL UNION ALL
    SELECT 4 a, 5 b FROM DUAL UNION ALL
    SELECT 5 a, 6 b FROM DUAL),
    t2 AS
    (SELECT 1 c FROM DUAL UNION ALL
    SELECT 2 c FROM DUAL UNION ALL
    SELECT 3 c FROM DUAL UNION ALL
    SELECT 5 c FROM DUAL)
    SELECT DISTINCT t1.a, t2.c, t1.b, level, SYS_CONNECT_BY_PATH(t1.a, '/') Path
    FROM t1 INNER JOIN t2
    ON t1.a = t2.c
    CONNECT BY t1.a = PRIOR t1.b
    START WITH t1.a = 1
    ORDER BY
    1,2,3;
    --Result:
    --1     1     2     1     /1
    --2     2     3     2     /1/2
    --3     3     4     3     /1/2/3
    --Statement 2:
    WITH t1
    AS
    (SELECT 1 a, 2 b FROM DUAL UNION ALL
    SELECT 2 a, 3 b FROM DUAL UNION ALL
    SELECT 3 a, 4 b FROM DUAL UNION ALL
    SELECT 4 a, 5 b FROM DUAL UNION ALL
    SELECT 5 a, 6 b FROM DUAL),
    t2 AS
    (SELECT 1 c FROM DUAL UNION ALL
    SELECT 2 c FROM DUAL UNION ALL
    SELECT 3 c FROM DUAL UNION ALL
    SELECT 5 c FROM DUAL)
    SELECT DISTINCT t1.a, t2.c, t1.b, level, SYS_CONNECT_BY_PATH(t1.a, '/') Path
    FROM t1 CROSS JOIN t2
    WHERE t1.a = t2.c
    CONNECT BY t1.a = PRIOR t1.b
    START WITH t1.a = 1
    ORDER BY
    1,2,3;
    --Result:
    --1     1     2     1     /1
    --2     2     3     2     /1/2
    --3     3     4     3     /1/2/3
    --5     5     6     5     /1/2/3/4/5My details:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE     11.2.0.2.0     Production
    TNS for Solaris: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    blama wrote:
    Hello Paul,
    that means that "a,b" isn't the same as "a CROSS JOIN b".
    I don't think that that is really the case.
    Do you have docs on this one?No explicit docs just (my) logic - having said that, I suppose it is implied that if you are doing ANSI style joins, it's not the where clauses that
    are specifying the join.
    If you do t1,t2 where t1.a=t2.a then Oracle figures out the kind of join from the (relevant) where clauses and treats the other where clauses after the CONNECT BY.
    If you do t1 cross join t2 where t1.a=t2.a then you are saying the join is completely specified by the CROSS JOIN - i.e it's Cartesian. Oracle doesn't look at the where clauses for this. Therefore
    all where clauses are treated as 'other' and are evaluated after the CONNECT BY.
    So, in my mind it's 10g that has the bug.

  • Cross joins on queries

    HI,
        how we can apply cross joins on select query.plz help me .I am using tables ekko,ekpo and lfa1 .Plz help.

    Hi Amardeep,
    as code given by one of guru's in the above joins statement is good when only if use the KEY-FIELDS in where condition if not it causes performance issue , so that you can use the FOR ALL ENTRIES IN statement which it gives good perfomance.
    Table declarations
    TABLES: ekko, "Purchasing Document Header
            ekpo, "Purchasing Document Item
            lfa1. "Vendor Master (General Section)
    Declaration of types:
    data: BEGIN OF tbl_ekko,
             ebeln TYPE ebeln,
             lifnr TYPE lifnr,
           END OF tbl_ekko.
    data: BEGIN OF tbl_ekpo,
             ebeln TYPE ebeln,
             ebelp TYPE ebelp,
           END OF tbl_ekpo.
    data: BEGIN OF tbl_lfa1,
             lifnr TYPE lifnr
             ebelp TYPE ebelp,
           END OF tbl_lfa1.
    *Selection screen:
    PARAMETERS: p_lifnr TYPE lifnr,
                             p_ebeln type ebeln.
    Selection (JOIN):
    START-OF-SELECTION.
    SELECT lifnr
       FROM lfa1
        INTO  table tbl_lfa1
    WHERE lifnr EQ p_lifnr.
    if sy-subrc = 0.
    sort tbl_lfa1 by lifnr.
    endif.
    if not tbl_lifnr is initial.
    SELECT ebeln lifnr
       FROM ekko
        INTO  table tbl_ekko
         FOR ALL INTRIES IN tbl_lfa1
    WHERE ebeln EQ p_ebeln
         AND  lifnr EQ tbl_lfa1-lifnr.
    if sy-subrc = 0.
    sort tbl_ ekko by ebeln.
    endif.
    endif.
    if not tbl_ekko is initial.
    SELECT ebeln ebelp
       FROM ekpo
        INTO  table tbl_ekpo
         FOR ALL INTRIES IN tbl_ekko
    WHERE ebeln EQ tbl_ekko-eblen.
    if sy-subrc = 0.
    sort tbl_ ekpo by ebeln.
    endif.
    endif.
    END-OF-SELECTION.
    Main program logic:
      LOOP AT tbl_ekpo.
    read table ekko with key ebeln = tbl_ekpo-ebeln BINARY SEARCH.
    if sy-subrc = 0
        WRITE: / tbl_ekko-ebeln,
                      tbl_ekko-ebelp,
                      tbl_ekpo-lifnr.
    endif.
      ENDLOOP.
    <b>NOTE : use only KEY-FIELDS in WHERE condition for better perfomance</b>
    In that above code you can change a/c to ur inputs availabe.
    <b>Reward with points if helpful.</b>
    Regards,
    Vijay

  • Fetch multiple rows using cross-join technique

    Hello.
    Can anyone suggest a method to return 3 rows from a query when only one row would otherwise be returned?
    I'm trying to achieve the Logical SQL analog to this -
    SELECT x.foo, p.id, p.name FROM people p CROSS JOIN (SELECT 1 AS foo UNION ALL SELECT 2 UNION ALL SELECT 3) x;Reason: I want to force a three (n) row result and use GROUP BY with case statements to create 3-level summary.
    Here is a simple Logical SQL expression that works for my OBI setup -
    SELECT
         "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number saw_0,
         "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".SR_Operating_Unit_Name saw_1
    FROM
         "[Noetix-NoetixGlobalRepository] NoetixViews for Oracle Service"     
    WHERE
         ("- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number = '338246')But I think I cannot do this -
    SELECT
         "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number saw_0,
         "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".SR_Operating_Unit_Name saw_1
    FROM
         "[Noetix-NoetixGlobalRepository] NoetixViews for Oracle Service"
         CROSS JOIN (SELECT 1 AS foo UNION ALL SELECT 2 UNION ALL SELECT 3)
    WHERE
         ("- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number = '338246')But what can I do?
    Thank you.
    -cs

    Hi CSeelig ,
    The BI Server uses the ANSI SQL standard. Then all SQL that follows this specification will in OBIEE work.
    I have made an example with a densification:
    http://gerardnico.com/wiki/dat/obiee/logical_sql/obiee_sql_densification
    You will see a cross join to make a densification.
    Cheers
    Nico

Maybe you are looking for

  • Printing multi pages in Illustrator

    Hi, Is it Possable to creat a Script that will print multiple pages from illustator but it ask you what Paper size you want e.g. A4 or A3 i know it is possible to make one and it ask how many pages you want. but i unfortunatly can't make it change pa

  • After changing my battery, everything disappeared?!

    My battery on my macbook completely died so I bought a new one and replaced it. For the first hour everything was fine and I let the computer die. I charged all night, woke up this morning and turned the computer on. Everything was gone and it reset

  • Uploading book to Blurb using Lightroom 5, rendereing is OK but gets stuck at uploading, will not complete.

    Hi I'm using Lightroom 5 loaded onto a Windows PC, 64 bit. I've cleared up disc space so that is not a problem. Building the book is OK. But when I select the Send Book to Blurb button, it gets to about 60-70% complete but then stops. The book is 154

  • Implementing Sharepoint with Hyperion 9.3

    I am hoping someone would be able to help me with understanding how Sharepoint can send/retrieve data from Hyperion Planning 9.3. I am tempted to use smartview as a data pull provider, but I am wondering if anyone has build APIs, web interfaces etc.

  • LIS Info Structure with table MKPF/MSEG

    Hi Gurus, I have a view made up of table MKPF/MSEG (74 fields in totals). Based on my requirement (loading archived and non archived marerial movements data) I am looking to create an Info structure with the same 74 fields - to connect the LIS infost