Outer join not returning missing records.

Hi All,
Can you please look at the query and see why I don't get any record. There is no item '0141884' for cust_id '1259' in the nfpc_gpm_expense table.
Thank you in advance.
A/A
   SELECT DISTINCT rctla.customer_trx_id, msi.segment1 item_number,
                   rcta.trx_date trx_date, rcta.bill_to_customer_id cust_id,
                     (rctla.quantity_invoiced)
                   * NVL (msi.attribute13, 1) quantity,
                     rctla.unit_selling_price
                   * rctla.quantity_invoiced net_sales,
                   cic.material_cost * rctla.quantity_invoiced product_cost,
                     (rctla.unit_selling_price * rctla.quantity_invoiced
                   --  - (rctla.unit_selling_price * rctla.quantity_credited)
                   - (cic.material_cost * rctla.quantity_invoiced) gp_dollars,
                   nge.expense_amt
              FROM ra_customer_trx_all rcta,
                   ra_customer_trx_lines_all rctla,
                   cst_cost_types cct,
                   cst_item_costs cic,
                   mtl_system_items_b msi,
                   nfpc_gpm_expense nge
          WHERE rcta.complete_flag = 'Y'
               AND rcta.interface_header_attribute1 NOT LIKE '%B'
               AND rcta.interface_header_context = 'ORDER ENTRY'
               AND rcta.batch_source_id IN (1068, 1069)
               AND rcta.customer_trx_id = rctla.customer_trx_id
               AND rctla.inventory_item_id = msi.inventory_item_id
               AND UPPER (cct.cost_type) = 'FROZEN'
               AND cic.cost_type_id = cct.cost_type_id
               AND cic.inventory_item_id = msi.inventory_item_id
               and rcta.trx_date = '01-DEC-2009'
              and msi.segment1 = '0141884'
               and rcta.bill_to_customer_id = '1259'
               and msi.segment1= nge.item_number(+)
               and rctla.ATTRIBUTE1 = nge.DIVISION
               and rcta.bill_to_customer_id = nge.CUST_ID
              

Table nfpc_gpm_expense is
  CUSTOMER_NO        VARCHAR2(20),
  ITEM_NUMBER        VARCHAR2(10),
  EXPENSE_AMT        VARCHAR2(20),
  DIVISION           VARCHAR2(20),
  INVENTORY_ITEM_ID  VARCHAR2(20),
  CUST_ID            VARCHAR2(20)Sample data in this table is
CUSTOMER_NO     ITEM_NUMBER     EXPENSE_AMT     DIVISION     INVENTORY_ITEM_ID     CUST_ID
02250000     0261884          1.76          B          8716               1259And this is the result of the query. Note that item 0141884 is missing from the result while as this item was sold on that day for this customer but since it is not in the nfpc_gpm_expense table, it doesn't show up.
CUSTOMER_TRX_ID     ITEM_NUMBER     DIVISION     TRX_DATE     CUST_ID     QUANTITY     ORDER_NO     EXPENSE_AMT     NET_SALES     PRODUCT_COST     GP_DOLLARS     EXPENSE
887617     0261884     B     12/1/2009     1259     60     1047572     1.76     662.4     338.4     324     105.6Edited by: asgar_amin on Mar 5, 2010 12:46 PM

Similar Messages

  • Outer Join not returning rows

    Hi,
    i have a view based on the following statement. I can't get the unmatched rows from table 'npe' to show up in the result.
    SELECT DISTINCT rctla.customer_trx_id, msi.segment1 item_number,
                    rcta.trx_date trx_date, rcta.bill_to_customer_id cust_id,
                    (rctla.quantity_invoiced) * NVL (msi.attribute13, 1) quantity,
                    ROUND ((rctla.unit_selling_price * rctla.quantity_invoiced),
                           0
                          ) net_sales,
                    ROUND ((cic.material_cost * rctla.quantity_invoiced),
                           0
                          ) product_cost,
                    ROUND ((npe.expense * rctla.quantity_invoiced), 0) expense,
                    ROUND (  (rctla.unit_selling_price * rctla.quantity_invoiced
                           - (  cic.material_cost * rctla.quantity_invoiced
                              + rctla.quantity_invoiced * npe.expense
                           0
                          ) gp_dollars
               FROM ra_customer_trx_all rcta,
                    ra_customer_trx_lines_all rctla,
                    cst_cost_types cct,
                    cst_item_costs cic,
                    mtl_system_items_b msi,
                    nfpc.nfpc_gpm_expense npe,
                    hz_cust_accounts hca
              WHERE rcta.complete_flag = 'Y'
                AND rcta.interface_header_attribute1 NOT LIKE '%B'
                AND rcta.interface_header_context = 'ORDER ENTRY'
                AND rcta.batch_source_id IN (1068, 1069)
                AND rcta.customer_trx_id = rctla.customer_trx_id
                AND rctla.inventory_item_id = msi.inventory_item_id
                AND UPPER (cct.cost_type) = 'FROZEN'
                AND cic.cost_type_id = cct.cost_type_id
                AND cic.inventory_item_id = msi.inventory_item_id
                AND npe.customer_no = hca.account_number
                AND hca.cust_account_id = rcta.bill_to_customer_id
                AND rcta.trx_date BETWEEN '01-FEB-10' AND '01-FEB-10'
                AND rctla.inventory_item_id = npe.inventory_item_id(+)
                AND rctla.customer_trx_id = '903670';I know there are two inventory_item_id rows that are not in the nfpc_gpm_expense table but are in the 'rctla' and 'msi' tables.
    I am on RDBMS 9i .
    Thanks in advance for your time.
    A/A

    Hi Asgar,
    check if this helps:
    SELECT DISTINCT rctla.customer_trx_id, msi.segment1 item_number,
                    rcta.trx_date trx_date, rcta.bill_to_customer_id cust_id,
                    (rctla.quantity_invoiced) * NVL (msi.attribute13, 1) quantity,
                    ROUND ((rctla.unit_selling_price * rctla.quantity_invoiced),
                           0
                          ) net_sales,
                    ROUND ((cic.material_cost * rctla.quantity_invoiced),
                           0
                          ) product_cost,
                    ROUND (( nvl(npe.expense,1 ) * rctla.quantity_invoiced), 0) expense,   --included NVL
                    ROUND (  (rctla.unit_selling_price * rctla.quantity_invoiced
                           - (  cic.material_cost * rctla.quantity_invoiced
                              + rctla.quantity_invoiced * nvl(npe.expense,1 )                        --included NVL
                           0
                          ) gp_dollars
               FROM ra_customer_trx_all rcta,
                    ra_customer_trx_lines_all rctla,
                    cst_cost_types cct,
                    cst_item_costs cic,
                    mtl_system_items_b msi,
                    ( select nge.expense, nge.inventory_item_id, rctla2.customer_trx_line_id
                      from nfpc.nfpc_gpm_expense nge,
                           hz_cust_accounts_all hcaa,
                           ra_customer_trx_all rcta2,
                           ra_customer_trx_lines_all rctla2
                      where nge.customer_no = hcaa.account_number
                      and   hcaa.cust_account_id = rcta2.bill_to_customer_id
                      and   rcta2.customer_trx_id = rctla2.customer_trx_id
                    ) npe,                                      --created inline view for npe
                    --nfpc.nfpc_gpm_expense npe,                --commented
                    hz_cust_accounts hca
              WHERE rcta.complete_flag = 'Y'
                AND rcta.interface_header_attribute1 NOT LIKE '%B'
                AND rcta.interface_header_context = 'ORDER ENTRY'
                AND rcta.batch_source_id IN (1068, 1069)
                AND rcta.customer_trx_id = rctla.customer_trx_id
                AND rctla.inventory_item_id = msi.inventory_item_id
                AND UPPER (cct.cost_type) = 'FROZEN'
                AND cic.cost_type_id = cct.cost_type_id
                AND cic.inventory_item_id = msi.inventory_item_id
                --AND npe.customer_no = hca.account_number        --commented
                AND hca.cust_account_id = rcta.bill_to_customer_id
                AND rcta.trx_date BETWEEN '01-FEB-10' AND '01-FEB-10'
                AND rctla.inventory_item_id = npe.inventory_item_id(+)
                AND rctla.customer_trx_line_id = npe.customer_trx_line_id(+)
                AND rctla.customer_trx_id = '903670';Regards
    Imran

  • ORA-30563, Outer Join not allowed in select list

    I can not find any information about this error message that I am getting.
    I have just upgraded my Oracle database from Version 7.3 to Version 8.1.7, a stored procedure that was written in v7.3 has outer joins in the select statement.
    when trying to run this proc in version 8 I get this meesage.(ORA-30563, Outer Join not allowed in select list)
    code ex:
    Select alt.id
    decode(alt.advise, NULL, NULL, AA.act_yr(+))||'-'||AA.act_per(+)||'-'||AA.Acc_per_no(+)) as advise_no
    from alt, AA;
    Is there any information about this message anywhere? or does anybody know if this is a known issue with oracle ver 8.1.7?
    Thanks
    CJ

    It appears to have been a bug in 7.x
    From a metalink note on bugs fixed in 8i (doc 132632.1)
    974742 Oracle does not report an error if (+) is specified in select-list. The OUTER JOIN operator (+) is only valid in WHERE clause predicates. As this is not flagged as an error the query can give unexpected results. The correct action to avoid this problem is to fix the query.
    Ken

  • Dynamic From statement in select query and/or outer join not working

    Dear Experts, I have a select query where the select columns are dynamic, the where condition is also dynamic. It is of the below format:
    Select (dynamic columns) INTO <wa>
    FROM a inner join b on af1 = bf1
    inner join c on af2 = cf2......
    WHERE (dynamic conditios)
    ORDER BY ( dynamic sort condition).
    Now I have to include some tables (dynamically depending on the user input) in the inner join statement which will give description for the selected fields. And these database tables may or may no be empty. So in this case, my select query will not return any data if these tables are empty. And I dont want that.
    I tried using outer join for the extra tables but it gave me a runtime error. I also tried forming the inner join statement dynamically but it was not supporting.
    Kindly give me pointers.
    Thanks

    Hey thanks for the reply, but the problem is not solved.
    I am already using  ( fileds, value) like table in my where condition and the select statement was working properly.
    the problem is that now I have to include some tables in the join statement which can be empty and so i want to use Outer join.
    But I am getting a runtime error as below:
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SYNTAX', was not
         caught in
        procedure "ZATSCSNG_RFC_READ_TABLE" "(FUNCTION)", nor was it propagated by a
         RAISING clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        The running ABAP program wanted to execute a SELECT statement whose
        WHERE condition was (partly) specified dynamically. The part that is
        specified in an internal table at runtime is compared to a field of the
        right table of an LEFT OUTER JOIN. Such comparisons are not supported by
         all database systems and are therefore not allowed.

  • Outer Join not functioning

    I have a query as shown below
    select w.columns1, w.cloumn2, w.counter
    Select a.columns1, a.cloumn2, a.rownum counter
    from (subquery a
    union
    subquery b)
    ) w
    view b
    where
    w.counter(+) = y.counter,
    The view has standard 12 records with a value 0. Now my problem is that for each product_key in main query, if i receive less then 12 records then the oter join with view should halp me to fetch 12 records for a particular product.
    But soehow the outer join ins not working.
    HELP required ASAP
    Thanks in Advance
    Ajit

    SELECT
    w.CA_NUMBER, W.payment_date, y.counter
    from
    select /*p.portfolio_id, p.ca_number,p.investor_type_code, p.owner_id,
              p.ca_process_date,p.product_month_id,
              p.Transaction_Type,p.payment_date,
              row_number() OVER (PARTITION BY p.ca_number ORDER BY p.ca_process_date) counter
              p.portfolio_id, p.ca_number,p.ca_process_date,p.Transaction_Type,
              row_number() OVER (PARTITION BY p.ca_number ORDER BY p.ca_process_date desc) counter,
              payment_date
    from
              -- getting records for both the facility and the fee transaction
              -- select records for the facility transaction
              SELECT x1.portfolio_id, x1.ca_number,x3.investor_type_code, x4.owner_id, x2.ca_process_date,x1.product_month_id,
                        'CA' Transaction_Type,x2.ca_effective_date payment_date
              FROM dls_dm.ca_transaction_fact x,
              dls_dm.ca_product_dimension x1,
              dls_dm.ca_transaction_dimension x2,
              dls_dm.investor_dimension x3,
              dls_dm.owner_dimension x4,
                        dls_rep.adm_acbs_periods x5
              WHERE ( (x1.product_key = x.product_key) )
                        AND (x2.transaction_key = x.transaction_key)
                             AND (x3.investor_key = x.investor_key)
                             AND (x4.owner_key = x.owner_key)
                             AND (x1.product_month_id = 200508)
                             -- to be removed later AND (x1.product_month_id = to_char(x5.Last_processing_date,'yyyymm'))
                             -- and x1.ca_number = '0000000215'
              Union all
              -- select records for the facility transaction
              SELECT x1.portfolio_id, x1.ca_number,x3.investor_type_code, x4.owner_id, x2.process_date,x1.product_month_id,
              'FEE' Transaction_Type, x2.effective_date payment_date
              FROM dls_dm.ca_fee_transaction_fact x,
              dls_dm.ca_product_dimension x1,
              dls_dm.fee_transaction_dimension x2,
              dls_dm.investor_dimension x3,
              dls_dm.owner_dimension x4,
                        dls_rep.adm_acbs_periods x5
              WHERE ( (x1.product_key = x.product_key) )
                        AND (x2.transaction_key = x.transaction_key)
                             AND (x3.investor_key = x.investor_key)
                             AND (x4.owner_key = x.owner_key)
                             AND (x1.product_month_id = 200508)
                             -- to be removed later AND (x1.product_month_id = to_char(x5.Last_processing_date,'yyyymm'))
                             --and x1.ca_number = '0000000215'
         )p
    ORDER BY p.ca_number ASC, p.ca_process_date DESC
         )W,
         dls_dm.test_view y
    where w.counter(+) = y.counter
    and     w.counter <=12
    order by 1,3
    the code for y starts from here
    CREATE OR REPLACE FORCE VIEW DLS_DM.TEST_VIEW
    (CA_NUMBER, PAYMENT_DATE, COUNTER)
    AS
    select CA_NUMBER, payment_date, counter
         from
              select 1 counter, 0 payment_date, '' CA_NUMBER from dual
              union
              select 2 counter, 0 payment_date, '' CA_NUMBER from dual
              union
              select 3 counter, 0 payment_date,'' CA_NUMBER from dual
              union
              select 4 counter, 0 payment_date,'' CA_NUMBER from dual
              union
              select 5 counter, 0 payment_date,'' CA_NUMBER from dual
              union
              select 6 counter, 0 payment_date, '' CA_NUMBER from dual
              union
              select 7 counter, 0 payment_date, '' CA_NUMBER from dual
              union
              select 8 counter, 0 payment_date, '' CA_NUMBER from dual
              union
              select 9 counter, 0 payment_date, '' CA_NUMBER from dual
              union
              select 10 counter, 0 payment_date, '' CA_NUMBER from dual
              union
              select 11 counter, 0 payment_date, '' CA_NUMBER from dual
              union
              select 12 counter, 0 payment_date, '' CA_NUMBER from dual
              ) y;

  • Merging two complemental result sets... or OUTER JOINs not working?

    Dear experts!
    Again I have a very difficult problem for which I ask Your help, but this time I am better prepared than last time and can deliver sample data of my (hopefully not too much) simplified example:
    create table Subjects(
    pk_id          number          not null primary key,
    title          varchar2(128)
    create table People(
    pk_id          number          not null primary key,
    name          varchar2(128)
    create table Results(
    pk_id          number          not null primary key,
    fk_subjects_id     number,
    fk_people_id     number,
    result          number
    insert into Subjects(pk_id, title) values (1, 'Choosing a recipe')
    insert into Subjects(pk_id, title) values (2, 'Shopping ingredients')
    insert into Subjects(pk_id, title) values (3, 'Preparations')
    insert into Subjects(pk_id, title) values (4, 'Cooking for beginners')
    insert into Subjects(pk_id, title) values (5, 'Eating for pros')
    insert into Subjects(pk_id, title) values (6, 'Dishwashing for everyone')
    insert into Subjects(pk_id, title) values (7, 'Digesting for experts')
    insert into Subjects(pk_id, title) values (8, 'Becoming hungry again...')
    insert into Subjects(pk_id, title) values (9, 'Redo from start')
    insert into People(pk_id, name) values (1, 'Hank')
    insert into People(pk_id, name) values (2, 'Cloe')
    insert into People(pk_id, name) values (3, 'Mary')
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (1, 1, 1, 2)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (2, 2, 1, 4)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (3, 3, 1, 3)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (4, 9, 1, 5)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (5, 1, 2, 4)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (6, 2, 2, 1)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (7, 3, 2, 5)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (8, 4, 2, 2)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (9, 5, 2, 3)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (10, 6, 2, 2)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (11, 7, 2, 1)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (12, 4, 3, 3)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (13, 5, 3, 5)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (14, 7, 3, 1)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (15, 8, 3, 5)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (16, 9, 3, 1)
    Please imagine this as an university for amateur cooks. Now I want to present them their performance record/"scorecard", for every student, only with her or his marks. On this performance record there should be a list of all 9 subjects possible to pass, and where students got a result, that result should be filled in. I thought that should be possible to achieve with something like this:
    SELECT PEOPLE.NAME, SUBJECTS.TITLE, RESULTS.RESULT FROM RESULTS
    JOIN PEOPLE ON PEOPLE.PK_ID = RESULTS.FK_PEOPLE_ID
    JOIN SUBJECTS ON SUBJECTS.PK_ID = RESULTS.FK_SUBJECTS_ID
    WHERE RESULTS.FK_PEOPLE_ID = 2
    But also using (LEFT|RIGHT|FULL) OUTER JOINs here does not help me to get what I want, I always only get
    NAME TITLE RESULT
    Cloe Choosing a recipe 4
    Cloe Shopping ingredients 1
    Cloe Preparations 5
    Cloe Cooking for beginners 2
    Cloe Eating for pros 3
    Cloe Dishwashing for everyone 2
    Cloe Digesting for experts 1
    But I want:
    NAME TITLE RESULT
    Cloe Choosing a recipe 4
    Cloe Shopping ingredients 1
    Cloe Preparations 5
    Cloe Cooking for beginners 2
    Cloe Eating for pros 3
    Cloe Dishwashing for everyone 2
    Cloe Digesting for experts 1
    Cloe Becoming hungry again...
    Cloe Redo from start
    Without having to fill in empty rows for all students which did not take all exams yet.
    Is it possible? If so, how?
    Thank You very much in advance and Happy Easter to everyone! :-)
    With kind regards,
    Chriss
    Edited by: user9355711 on 01.04.2010 07:01
    Edited by: user9355711 on 01.04.2010 07:28
    Edited by: user9355711 on 01.04.2010 07:29

    Also;
    var n number
    exec :n := 2;
    PL/SQL procedure successfully completed
    n
    2
    select ppl.name, sub.title, res.result
      from subjects sub, people ppl, results res
    where sub.pk_id = res.fk_subjects_id(+)
       and ppl.pk_id = :n
       and res.fk_people_id(+) = :n
    order by sub.title;
    NAME       TITLE                         RESULT
    Cloe       Becoming hungry again... 
    Cloe       Choosing a recipe                  4
    Cloe       Cooking for beginners              2
    Cloe       Digesting for experts              1
    Cloe       Dishwashing for everyone           2
    Cloe       Eating for pros                    3
    Cloe       Preparations                       5
    Cloe       Redo from start          
    Cloe       Shopping ingredients               1

  • Outer join not working

    Hello everybody,
    I have a folder based on materialized view (Detailed folder). There is another folder which is based on a table (master folder). i have created a jooin and select option as "outer join on master folder". The join is not working properly. Am i doing asomething wrong. Discoverer version is 10.1.2 and database version is 10.2.0.3. i have been creating outer joins among folders based on tables but i am not sure about whats wrong this time??? materalized view defination is as follows:
    CREATE MATERIALIZED VIEW MW
    BUILD IMMEDIATE
    REFRESH FORCE
    START WITH SYSDATE
    NEXT TRUNC(SYSDATE+1)+1/4
    WITH PRIMARY KEY
    AS
    SELECT * FROM VIEW
    Thanx for your help
    Regards,
    Najeeb

    So, let me see if I got this...
    You have a table and a materialized view. There is a join between the two, where the table is the master, and the MV is the detail. The join is set to be an outer join on master. Ultimately, you want to see the values in the MV where the join condition is NULL.
    What boggles me is that you say the query runs fine in the database, but not in Disco. This could mean that there is a condition in the BA or in the worksheet. But, if that were the case, the condition should show up in the SQL generated by Disco.
    It looks like the where clause is the problem. NULL is never equal to anything, so when APPROVEDBY is null, the where clause should fail and no data returned. This explains Disco's behavior, but not SQL's.
    Something to try: Create a calculation in the materialized view folder of the business area like:
    NVL(APPROVEDBY, -1)
    I am assuming that all of your IDs are positive. Then modify the join to use the calculated column. This should convert the NULLS to values, and the report should work.

  • 8i Query not returning expected records

    Using Oracle 8i (8.1.7), a basic spatial query is not returning all the expected results. Table1 contains a variety of polygons; table2 is simply a set of rectangles. I want to return all objects from table1 that intersect a particular rectangle. The query below mostly works, but misses out some objects. On my system, 38 objects are returned where about 41 are expected; on the client system (which does not have identical data) the problem appears to be much worse, with hardly any objects being returned. The missing objects are clearly visible on the map, surrounded on all sides by objects which have been selected correctly. Help?
    Select t1.id from table1 t1, table2 t2
    where t1.IsCurrent = -1
    and (sdo_relate(t1.geoloc, t2.geoloc, 'mask=ANYINTERACT querytype=WINDOW') = 'TRUE')
    AND (t2.ID in ('001'));

    Hi,
    When the non-spatial predicate is dropped, you mentioned the
    objects are not missing. This means the spatial index (which will
    surely be used in this case) should be returning correct results.
    But it is possible the index is not used when other predicates are
    specified. Please look at the "execution plan" in both cases (when the
    objects are missing/not missing).
    Rewrite the query as:
    select /*+ ORDERED INDEX(t1 <spatial_index_name>) */ t1.id from t2, t1
    This should ensure a spatial-index-based evaluation.
    Let us know the execution plans and the behavior in either case.
    Btw, one thing to check is your tolerance values in
    user_sdo_geom_metadata.
    - Ravi.

  • Query Not Returning Enough Records

    have two tables that I am trying to join together. 
    The first table shows the income for each department of the store broken down by period like this:
    Store_Data:
    Store_Type  Dept    Year  Period  Sales
    Grocer      Produce   11  01      31865.00   
    Grocer      Produce   11  02      32525.00   
    Grocer      Produce   11  03      37490.00   
    Grocer      Meat      11  01      224.00   
    Grocer      Dairy     11  02      5850.00   
    Grocer      Dairy     11  03      33209.92   
    Grocer      Dry       11  03      1000.00
    The second table contains a record for each store showing it's goal, like this:
    Goal_Data:
    Store_Type  Dept    Year  Amount
    Grocer      Produce   11  157192.00
    Grocer      Canned    11  0.00
    Grocer      Paper     11  146820.00
    Grocer      Meat      11  2168.00
    Grocer      Dairy     11  50000.00
    Grocer      Frozen    11  29464.00
    Grocer      Pet       11  330096.00
    Grocer      Dry       11  1716.00
    Grocer      Pharmacy  11  0.00
    Grocer      Misc      11  6668.00
    Now, I have a query to join the two tables.  What I want is for all the records in the second table, whether or not there is a corresponding record in the first (such as 'Meat' and 'Dairy').
    I have to filter on Store_Data.Store_Type, Store_Data.Year, Store_Data.Period
    Crystal is outputting the following SQL:
    SELECT DISTINCT
        Store_Data.Store_Type,
        Store_Data.Dept,
        Store_Data.Year,
        Store_Data.Period,
        Store_Data.Sales,
        Goal_Data.Amount
    FROM  
        Store_Data
        RIGHT OUTER JOIN Goal_Data
            ON ((Goal_Data.Dept=Store_Data.Dept) AND
            (Goal_Data.Store_Type=Store_Data.Store_Type))
            AND (Goal_Data.Year=Store_Data.Year)
    WHERE 
        Store_Data.Store_Type='Grocer'
        AND Store_Data.Year='11'
        AND (Store_Data.Period='01'
            OR Store_Data.Period='02'
            OR Store_Data.Period='03')
    But I'm only getting the records from the Store_Data table (and records in Goal_Data where the "ON" fields match).  Testing in SQL Server verifies that the query is producing incorrect output.
    What do I need to change to do what I'm wanting to do?

    It looks like the thread is going to take a left turn just about now.
    The problem appears to be that, for the query to work properly, the filter for the period has to be in the joins "ON" clause.
    This I accept.
    And, apparently, trhe only way to get a parameter value to go into that area is by using a stored procedure.
    To that end, I have created a Stored Procedure which takes three parameters, "Store_Type", "Year", and "Quarter"
    I have verified that the results are what I need.  I plugged the stored procedure into my report (which is technically a sub-report) and it asked me for the values of the parameters.  Entering them in, I do get a result that I would expect.
    Everything good so far.
    Now, about those parameters (both for the Storeed Procedure as well as the report).  As I said, the report that I have been working is actually a sub-report, one of five which will be on the main report.  Each report will require the same three parameters, two of which (year and quarter) need to be selected by the user and will feed the same values to all five sub-reports.  The third parameter should be "hard-coded" to each particular sub-report.
    Now for the issue (the main point being that I am unfamiliar with CR and Stored Procedures)...
    The way things are going now, when all is said and done, it looks like the user will be required to enter in the year and quarter for each sub-report (the Store_Type will be there too, but it will have a default value).  That's the user typing in '2012' for the year five times and '1' for the quarter five times.  This is unacceptable.
    So, how do I create a single Year parameter and a single Quarter parameter that will feed all five reports?
    Apparently trying to code it in the Report Selection Formula is not the right path.
    So, can someone either walk me through the process, or point me to a tutorial where the process is explained?
    TIA

  • Left Outer Join Not working in BI 7.0 Infoset

    Hi All,
    I am working on BI 7.0. I have to create a report where I have to display the Target values from a target DSO against the transactional data (Operational data).
    I have a DSO where for a “subteam” value target has been set up on different KPIs.
    In the Info Cube, I have transactional data on daily basis per “subteam”. I have to show the actual and target values.
    I have created an Info Set using Target DSO and Daily operational cube, so that I should able to compare the target and actual values of KPIs, for all the “subteam” values (From DSO, irrespective of whether the data is available in cube for those sub team).
    I have used Outer Left Join in the Info set (DSO on left side), but I am unable to see the desired results. It is working just like an inner join.
    Any Idea why the Outer Left Join is not working? The DSO has only one fey field called “subteam” on which I have set outer left join.
    Regards,
    Amit

    Hi,
    did you solve your problem? because I have the same issue right now: the left outer join doesn't seem to do its job.
    Let me know if you have found a solution, it would be appreciated.
    have a nice day,
    Dominic

  • Left Outer Join not working in Infoset.

    Hello Friends,
    I have two ODSes , one for planned data (zplan) and other is billing z ods (zsd_o03).
    now the situation is such that in my planned ODS  for one sold to party .
    SOLD TO        MATERRIAL CALMONT     PLANNED QUANTIY
    14315            100                06.2007           54
    14315            200                06.2007           20
    14315            300                06.2007           30
    14315            400                06.2007           10
    But in my Billing ODS iam having for Sold to 14315
    SOLD TO        MATERRIAL CALMONT     ACTUAL QUANTIY
    14315           100           06.2007                  20
    14315           200           06.2007                  30
    And my Bex ouput should be like
    SOLD TO        MATERIAL CALMONT        planned             ACTUAL QUANTIY
    14315            100                06.2007           54                                 20
    14315            200                06.2007           20                                30
    14315            300                06.2007           30                                  0
    14315            400                06.2007           10                                0
    So for this i made one Infoset and these ODses are linked by Sold_to , Materail,
    Calmonth.
    First i tried using Inner joing option , but the bottom two lines were not ciming , so used left outer join , and activated and recreated the query but still its showiong me the output same as inner join .. i.e
    14315            100                06.2007           54                                 20
    14315            200                06.2007           20                                30
    So i checked by writing a ABAP code in Se38 , but there its showing me the correct result ..
    So please anybody help me out because iam thinking that infoset is the right way to do this kind of reporting , or esle shall i make one ODS and populate it through this ABAP code..
    Thanks in advance.

    Hi , can anybody help me in this regard..
    Thanks ..

  • Outer Join not giving correct result

    I have two tables=> tab_child_tmp (product_id,region,child_val,mst_product) and
    tab_master_tmp (master_product_id,region,master_val)
    tab_child_tmp.mst_product is the foreign key referencing tab_master_tmp.master_product_id.
    Currently the tables are populated with below values
    tab_child_tmp
    PRODUCT_ID REGION CHILD_VAL MST_PRODUCT
    Arm-01,     CAL,     100,     Arm-Master
    Arm-01,     DEL,     222,     Arm-Master
    Arm-01,     CHEN,     55,     Arm-Master
    Arm-02,     MUM,     69,     Arm-Master
    Arm-02,     DEL,     90,     Arm-Master
    tab_master_tmp
    MST_PRODUCT     REGION     MASTER_VAL
    Arm-Master     , CAL,     390
    Arm-Master     , DEL,     300
    Arm-Master, CHEN,     450
    Arm-Master, MUM,     600
    Now I want to display the result in the below format
    PRODUCT_ID REGION CHILD_VAL MASTER_VAL
    1. Arm-01     , CAL, 100,     390
    2. Arm-01     , DEL, 222,     300
    3. Arm-01     , CHEN, 55,     450
    4. Arm-01     , MUM, 0,     600
    5. Arm-02     , MUM, 69,     600
    6. Arm-02     , DEL, 90,     300
    7. Arm-02     , CHEN, 0,     450
    8. Arm-02     , CAL, 0,     390
    When I am running the below query it is not returning the above 4,7 and 8 rows. Can you please provide the correct sql to get the above desired output
    SELECT
    a.product_id,
    nvl(a.region,b.region) geo,
    nvl(a.child_val,0)match_val,
    b.master_val
    FROM
    tab_child_tmp a,
    tab_master_tmp b
    WHERE
    a.mst_product(+) = b.master_product AND
    a.region(+) = b.region
    Thanks

    Hi
    Thanks for the reply. Please find below the details.
    Oracle Version*
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
    PL/SQL Release 10.2.0.1.0 - Production
    CORE     10.2.0.1.0     Production
    TNS for Solaris: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Create Table Script_
    create table TAB_CHILD_TMP
    PRODUCT_ID VARCHAR2(50),
    REGION VARCHAR2(100),
    CHILD_VAL NUMBER,
    MST_PRODUCT VARCHAR2(50)
    create table TAB_MASTER_TMP
    MST_PRODUCT VARCHAR2(50),
    REGION VARCHAR2(100),
    MASTER_VAL NUMBER
    Insert Script_
    INSERT INTO tab_child_tmp VALUES ('Arm-01','CAL',100,'Arm-Master');
    INSERT INTO tab_child_tmp VALUES ('Arm-01','DEL',222,'Arm-Master');
    INSERT INTO tab_child_tmp VALUES ('Arm-01','CHEN',55,'Arm-Master');
    INSERT INTO tab_child_tmp VALUES ('Arm-Master','MUM',69,'PLC1');
    INSERT INTO tab_child_tmp VALUES ('Arm-Master','DEL',90,'PLC1');
    INSERT INTO tab_master_tmp VALUES ('Arm-Master','CAL',390);
    INSERT INTO tab_master_tmp VALUES ('Arm-Master','DEL',300);
    INSERT INTO tab_master_tmp VALUES ('Arm-Master','CHEN',450);
    INSERT INTO tab_master_tmp VALUES ('Arm-Master','MUM',600);
    INSERT INTO tab_master_tmp VALUES ('PLC1','MUM',199);
    INSERT INTO tab_master_tmp VALUES ('PLC1','DEL',299);
    INSERT INTO tab_master_tmp VALUES ('PLC1','CHEN',399);
    Expected output logic*
    Need to display the product value for each region along with the value of master product for the corresponding product and region. If a product doesn't belong to a particular region, but the corresponding master product is, then that value also needs to be displayed for that product and region with child value as zero.
    ie. for product Arm-01 there is no record in tab_child_tmp for region "MUM", but it's master product 'Arm-Master' has a record for region 'MUM' in tab master_tmp table. So in ouput there will be a record for product 'Arm-01' and region-'MUM' with child value as 0 and master value as 600.
    Expected Output*
    PRODUCT_ID ~~~ REG ~~~ CHILD_VAL ~~~ MASTER_VAL
    Arm-01 ~~~ CAL ~~~ 100 ~~~ 390
    Arm-01 ~~~ DEL ~~~ 222 ~~~ 300
    Arm-01 ~~~ CHEN ~~~ 55 ~~~ 450
    Arm-01 ~~~ MUM ~~~ 0 ~~~ 600
    Arm-MASTER ~~~ MUM ~~~ 69 ~~~ 199
    Arm-MASTER ~~~ DEL ~~~ 90 ~~~ 299
    Arm-MASTER ~~~ CHEN ~~~ 0 ~~~ 399
    Please help

  • Outer join not working when filters are applied from Prompts

    Hi,
    Without values being selected from the dashboard prompts, my outer join is working fine with all the rows and all the columns showing up( as per requirement). But as soon as I select values in the prompts, only certain rows and columns show up.
    BTW, I have 2 prompts Year and Quarter. I put Year is Prompted or is null in the criteria. It works. BUT as soon as I also put in quarter numbers, it does not work.
    Is there a workaround for this?
    Thanks,
    Dan
    Edited by: Danny on Apr 26, 2013 12:10 PM

    I just experimented by adding is null to not only the year and quarter but to the row and column too and it worked!
    Thanks,
    Dan

  • LEFT OUTER JOIN not working as expected

    I'm testing a query from the portal. I've got two inputs:
    products
    {"ProductKey":1,"ProductAlternateKey":"abc","Color":"Red"},
    {"ProductKey":2,"ProductAlternateKey":"def","Color":"Blue"},
    {"ProductKey":3,"ProductAlternateKey":"ghi","Color":"Blue"}
    And temperatures:
    {"DeviceId":1,"Temperature":99},
    {"DeviceId":2,"Temperature":90},
    {"DeviceId":2,"Temperature":99},
    {"DeviceId":3,"Temperature":50},
    {"DeviceId":4,"Temperature":32}
    When I test a query with an (inner) join, I get two rows, one for Red and one for Blue as expected. However, when I change to a LEFT OUTER JOIN, I would expect to get three rows... one for Red, one for Blue, and one for NULL color. However, I only get one
    row with a NULL color. Here's the query. Is this a bug or am I misunderstanding?
    SELECT DateAdd(second,-5,System.TimeStamp) as WinStartTime
    , system.TimeStamp as WinEndTime
    , b.Color
    , Avg(r.Temperature) as AvgTemperature
    , Count(*) as EventCount
    FROM temperatures r
    LEFT OUTER JOIN products b ON r.DeviceId = b.ProductKey and DATEDIFF(hour,r,b) BETWEEN -6 AND 6
    GROUP BY TumblingWindow(second, 5), b.Color
    (Please excuse the contrived example, the lack of timestamps, and the 12 hour window... just testing.)
    http://artisconsulting.com/Blogs/GregGalloway

    Hi Greg,
    Thank you for raising this issue.
    We have deployed a fix today that corrects LEFT OUTER JOIN behavior on the in-browser query testing experience.
    Can you please confirm that the above query and input sources work for you?
    Thanks!
    Ziv.

  • FDM for PBCS - Drill Thru does not return any records in landing page

    This is referring to the Data Management functionality in PBCS, not on-premise FDMEE.
    I loaded in a file, for example:
    Region|Product|Account|Amount
    10|100|1000|9,000
    10|100|1000|1,000
    In FDM, I am using a multi dimensional map to derive another field. For example, if Region is 10 and Product is 100, than Department = 555.
    so in FDM, I would end up with
    10|100|1000|555|9,000
    10|100|1000|555|1,000
    Once loaded to PBCS, that loads in as:
    10|100|1000|555|10,000
    I built a form that shows this intersection, and then 'drilled to source'. When I get to the FDM landing page, there are no records shown. Is this because the derived field (department) does not exist in the source, or am I doing something wrong?
    Appreciate any help.

    Do you have access to the server logs by any chance?
    Can you check the dimension class for your Scenario dimension in your target application? is it set to SCENARIO?
    not showing source records is typically related to FDMEE not finding values in TDATASEG table.
    HTH

Maybe you are looking for

  • Add values to one variable in a loop

    Hello, I have a while loop where I read a counter and get values. Now I want to add all values to one variable. I think an array won't be good because the loop can run a long time and an array is limited. And the end I want to have the sum of all val

  • IPhoto Library has totally disappeared!

    I'm really hoping that someone can advise me. I switched from Windows to Mac two Christmases ago and until now would not have changed back. But now, my confidence is seriously damaged. Here's the thing:- The photo library on my wife's iMac has disapp

  • Recursive fitness

    hi! I am trying to rebuild my script to make a recursive fitness of textframes. With a deep nested set of anchored objects (inline and custom position) All works well,but when i in my loop tries to first change the current textframe and directly afte

  • Ipod Nano stalling after adding song to On-The-Go Playlist

    I'm using a 2GB Ipod Nano and I just bought it less than a month ago. Ive noticed that the Ipod stalls or lags for 3 seconds whenever I do this procedure: 1:Play a song. 2: Go back to the previous menu and add a song to the On-The-Go Playlist 3: Scro

  • CM showing wrong OS code

    Hi all, We installed new WAE into the network with 4.1.5f code, but when i look from the central manager it is showing 4.1.5c.,, wierd,, the whole setup is working on 4.1.5f.. any reasons ,, or possible solution. Thanks, Dhana