Left outer join functions like simple join

I created two views SCO_REQGROSSLINES_V & SCO_REQLINESCOMPLETE on Oracle requisitions base tables. Our business rules enforce the following identity: the number of gross requisition lines will always be greater than or equal to the number of requisition lines complete. (By complete I mean delivered.)
Each view has a key named DATESUBINV_KEY constructed of a transaction date and the subinventory code using this logic:
, TO_CHAR(TRUNC(transaction_date),'YYYYMMDD') || subinventory_code
On 03-SEP-2010 a user created a requisition with one line item for material from the HEAT subinventory which was not delivered. This row is retuned in the result set when I query on SCO_REQGROSSLINES_V but is NOT returned when I query on SCO_REQLINESCOMPLETE. So far so good.
When I issue either of the the following left outer joins I do not get the row for the row for the HEAT subinventory on 03-SEP-2010:
select rgl.trxn_date
, rgl.subinventory
, rgl.line_count gross_line_count
, rgl.ext_prc gross_value
, rlc.line_count lines_filled
, rlc.ext_prc lines_filled_value
from SCO_REQGROSSLINES_V rgl left outer join sco_reqlinescomplete_v rlc
ON rgl.datesubinv_key = rlc.datesubinv_key
where rgl.TRXN_DATE BETWEEN to_date('29-AUG-2010') AND to_date('04-SEP-2010')
and rlc.trxn_date BETWEEN to_date('29-AUG-2010') AND to_date('04-SEP-2010')
order by rgl.trxn_date, rgl.subinventory
select rgl.trxn_date, rgl.subinventory
, rgl.line_count gross_line_count
, rgl.ext_prc gross_value
, rlc.line_count lines_filled
, rlc.ext_prc lines_filled_value
from SCO_REQGROSSLINES_V rgl
, sco_reqlinescomplete_v rlc
where rgl.TRXN_DATE BETWEEN to_date('29-AUG-2010') AND to_date('04-SEP-2010')
and rlc.trxn_date BETWEEN to_date('29-AUG-2010') AND to_date('04-SEP-2010')
AND rgl.datesubinv_key = rlc.datesubinv_key(+)
order by rgl.trxn_date, rgl.subinventory
Question: Why would the left outer joins function as a simple join on DATESUBINV_KEY? Do keys on views function differently than keys defined in the data dictionary? If they do how can I make these keys to function like data dictionary keys?

Hi,
The WHERE clause is applied after the outer join is completed. In your example, rows from rgl will be in the result set even if they have no match in rlc. In those cases, all the columns from rlc will be NULL.
Okay, so you have these rows that contain data from rgl but NULLs where the data from rlc was supposed to go. Now it's time to start the WHERE clause. You then apply conditions like this in the WHERE clause:
AND     rlc.trxn_date BETWEEN ...NULL is between anything, so the row that the outer join prodeuced is rejected.
All conditions involivn columns from rlc probably need to be part of the join condition, not the WHERE clause.
For example, in you first query the FROM and WHERE clauses might be:
FROM          sco_reqgrosslines_v      rgl
LEFT OUTER JOIN  sco_reqlinescomplete_v  rlc  ON    rgl.datesubinv_key   = rlc.datesubinv_key
                                        AND   rlc.trxn_date       BETWEEN TO_DATE ( '29-AUG-2010'
                                                                    , 'DD-MON-YYYY'
                                              AND       TO_DATE ( '04-SEP-2010'
                                                          , 'DD-MON-YYYY'
WHERE   rgl.trxn_date     BETWEEN TO_DATE ( '29-AUG-2010'
                         , 'DD-MON-YYYY'
               AND     TO_DATE ( '04-SEP-2010'
                         , 'DD-MON-YYYY'
                         )Always use (at least) two arguments when calling TO_DATE.
Conditions that only involve rgl can be in the WHERE clause, but if any conditions from rlc are in the WHERE clause, then the effect will be the same as an inner join.
There no difference between tables and views (or sub-queries) in this regard: the same thing would happen regardless of whether rgl and rlc were really tables or not.

Similar Messages

  • Need to specify LEFT OUTER JOIN while using data from logical database BRM?

    I'm trying to extract data for external processing using SQVI. The fields required are in tables BKPF (Document Header) and BSEG (document detail) so I'm using logical database BRM. Note: required fields include the SPGR* (blocking reasons) which don't appear to be in BSIS/BSAS/BSID/BSAD/BSIK/BSAK, hence I can't just use a Table Join on any of these but have to use BSEG, hence BRM.
    If the document type is an invoice, I also need to include the PO number from table EKKO (PO header), if present, hence I'd like to add this to the list. However, if I do this, it seems that some records are no longer display, e.g. AB documents.
    The interesting thing is that not all records are suppressed, so it's not a simple case of the logical database using an effective INNER JOIN, but the effect is similar.
    In any event, is there a way to specify that the link to table EKKO should be treated as an effective LEFT OUTER JOIN, i.e. records from BKPF/BSEG should be included irrespective of whether any records from EKKO/EKPO exist or not?
    Alternatively, is there some other way to get the SPGR* fields (for example) from BSEG and still join the BKPF? Of course, one solution is to use multiple queries, but I was hoping to avoid this.

    Thanks for everyone's responses, I know how to work around the problem with sql, I am wanting to see if there is a way to make the outer joins filter go in the join clause instead of the where clause with Crystal Reports standard functionality. 
    We have some Crystal Reports users that are not sql users, i.e. benefit specialists, payroll specialists and compensation analysts who have Crystal Reports.  I was hoping this functionality was available for them.  I just made my example a simple one, but often reports have multiple outer joins with maybe 2 or three of the outer joins needing a filter on them that won't make them into an inner join. 
    Such as
    Select person information
    outer join address record
    outer join email record
    outer join tax record (filter for active state record & filter for code = STATE )
    outer join pay rates record
    outer join phone#s  (filter for home phone#)
    I thought maybe the functionality may be available, that I just don't know how or where to use it.  Maybe it is just not available.
    If it is not available, I will probably need to setup some standard views for them to query, rather than expecting them to pull the tables together themselves.

  • Need to adjust SQL query for left outer join in Crystal Reports 2008.

    I need to change this SQL 2005 query.....
    SELECT     omnicell_anl.DeviceIDsLastMetricTable.member_id, omnicell_anl.DeviceIDsLastMetricTable.[Device Name],
                          omnicell_anl.DeviceIDsLastMetricTable.Account, omnicell_anl.labeledLastMetrics.PROPERTY_NAME,
                          omnicell_anl.labeledLastMetrics.latest_monitor_value
    FROM         omnicell_anl.DeviceIDsLastMetricTable LEFT OUTER JOIN
                          omnicell_anl.labeledLastMetrics ON omnicell_anl.DeviceIDsLastMetricTable.member_id = omnicell_anl.labeledLastMetrics.member_id
    WHERE
        omnicell_anl.labeledLastMetrics.PROPERTY_NAME = ?MyProperty
    To this query in Crystal Reports Report Writer:
    SELECT     omnicell_anl.DeviceIDsLastMetricTable.member_id, omnicell_anl.DeviceIDsLastMetricTable.[Device Name],
                          omnicell_anl.DeviceIDsLastMetricTable.Account, omnicell_anl.labeledLastMetrics.PROPERTY_NAME,
                          omnicell_anl.labeledLastMetrics.latest_monitor_value
    FROM         omnicell_anl.DeviceIDsLastMetricTable LEFT OUTER JOIN
                          omnicell_anl.labeledLastMetrics ON omnicell_anl.DeviceIDsLastMetricTable.member_id = omnicell_anl.labeledLastMetrics.member_id AND
                          omnicell_anl.labeledLastMetrics.PROPERTY_NAME = ?MyProperty
    I can't seem to get the left outer join function of Crystal Reports to emulate the same SQL query in SQL 2005.  Any ideas on how I can create this same query in Crystal 2008?
    Thanks,
    Dominic
    Edited by: Dominic Carissimi on Oct 28, 2008 7:55 PM
    Edited by: Dominic Carissimi on Oct 28, 2008 7:56 PM

    If you want the list of values for command level parameter then you need to add another command like
    select PropertyField from table
    and delete the links between this command and the existing command.
    Now go to field explorer and edit the command level parameter and make it as dynamic and add the property field from newly added command.
    Hope this helps!
    Raghavendra

  • Left Outer Joining multiple tables to one source table FAILS with VLD-1511

    Hi all,
    Is it me, or is OWB unable to handle left outer joining 1 source table to multiple other tables?
    I want to load a fact table so I have 1 source table with measures. This table must be outer joined to some dimensions that have their FK in the fact table.
    The SQL statement would look like this (and is perfectly valid):
    select ...
    from input, dim1, dim2
    where input.c1 = dim1.c1(+)
    and input.c2 = dim2.c2(+);
    I put the where clause in the joiner operator and validate, but that gives me message VLD-1511: A table may be outer joined to at most one other table.
    Even splitting this up into one outer join per joiner still gives this message.
    A search and look around on the forum and on metalink shows there are related issues (like bug 3334035). Seemingly creating a view is the work-around to use.....? (ie downgrading owb to a simple gui tool) }-;
    Have other people experienced this problem of not being able to outer join one input table to multiple other tables?
    Thanks,
    Ed

    I have had some feedback from Oracle. It turns out this has to do with 2 issues. Below I have pasted the text that Support gave me:
    <---------- START QUOTE ---------->
    RESEARCH
    =========
    Bug 3437036 KEY LOOKUP DOES NOT DETECT ORA-1417 IN VALIDATE/GENERATE STEP
    Unpublished Bug 4211684 FORWARD PORT OF BUG 3437036
    shows:
    Some more development has been completed when this bug is fixed in Paris.
    The following are the details:
    1. If the join condition contains a full outer join such as
    tab1.c (+) = tab2.c (+) and tab2.c (+) = tab3.c
    then the new validations implemented for this bug do not apply since
    in OWB, full outer join triggers generation of joins in ANSI syntax.
    ANSI syntax does not have the original problem the base bug of this
    bug reported.
    2. If the join condition does not contain any full outer join condition,
    then the join is generated in Oracle join syntax, which is subject two
    several restrictions. The fix to this bug check two of the restrictions.
    3. The first restriction in Oracle syntax is that the outer join operator
    "(+)" can only directly be attached to a column name. If you attach it
    to an expression, such as the following:
    (tab1.c + 1) (+) = tab2.c
    Then there will be an ORA-936 error at the time of mapping deployment.
    For this case, I have added a validation message VLD-1512 to error out
    this situation.
    4. The second restriction in Oracle syntax is that a table can only be
    outer joined to exactly one other table.
    For example, this is an invalid join in Oracle syntax:
    tab1.c (+) = tab2.c and tab1.d (+) = tab3.d
    because tab1 is left outer joined to tab2 and tab3.
    But note that the following is still valid in Oracle syntax:
    tab1.c (+) = tab2.c and tab1.d = tab3.d (+)
    because tab1 is left outer joined to tab2 and right outer joined to tab3.
    So this latter case does not violate the restriction that "same oj" to
    more than 1 table is not allowed.
    If same oj to more than 1 table is specified in a join condition,
    VLD-1511 will be issued, and the map is made invalid.
    <---------- END QUOTE ---------->
    OWB does a partial validation, ie not all access paths are (can be) checked. A full check is only done by the database itself. So some scenarios (like checking whether multiple tables are outer joined the correct way) are not checked, and in this case are flagged with an error (even though it is actually a correct scenario).
    Seemingly this was not flagged with an error in earlier versions of OWB, so beware, OWB behaviour may change when upgrading...
    Alternative solutions are (1) using key lookups, (2) using a view with all outer joins in there, (3) using intermediate result tables between the joins.
    Hope this info helps some people prevent spending too much time on a false error message,
    Ed

  • Display all dates between date range (Time Dimension left outer join Fact)

    All,
    I have done some searching around this issue but within all the posts regarding date variables, date prompts and date filtering I haven't seen one exactly answering my issue (maybe they are and I just dont have my head around it correctly yet).
    My report requirement is to allow a user to select a start day and an end day. The report should show all activity between those two days - AND display 0/null on days where there is no activity. That second part is where I am getting hung up.
    The tables in question are:
    TimeDim
    EventFact
    CustomerDim
    My BMM is setup as follows:
    TimeDim left outer join EventFact
    CustomerDim inner join EventFact
    If I run a report selecting DAY from TimeDim and a measure1 from EventFact with day range 1/1/2010 - 12/31/2010 .. I get a record for every day and it looks perfect because of the left outer join between TimeDim and CustomerDim.
    But .. if I add in a field from CustomerDim, select TimeDim.DAY, CustomerDim.CUSTNAME, EventFact.MEASURE1, OBIEE only returns records for the days that have EventFact records.
    This is due to the fact that the TimeDim is still outer joined into EventFact but adding in CustomerDim makes OBIEE setup an inner join between those tables which then causes only data to be returned where EventFact data exists.
    There is a way around this in this simple case and that is to define the relationship between CustomerDim and EventFact as an outer join as well. This will give the desired effect (but an outer join between these two tables is not the true relationship) and as I add additional dimensions and add additional logical sources to a single dimension in the BMM it gets complicated and messy.
    Ive also messed with setting the driving table in the relationship, etc.. but it has not given the desired effect.
    Has anyone ever encountered the need to force display all dates within a specfied range with a fact table that may not have an entry for every date?
    Thanks in advance.
    K
    Edited by: user_K on Apr 27, 2010 11:32 AM

    It worked!!!* Even my time drill downs and date based filtering still work!
    That is awesome. Never would have thought of that intuitively.
    Now, just need a little help understanding how it works. When I run my report and check the logs I can see that two queries are issued:
    Query 1: Joins the fact table to all the associated dimensions. I even changed all the relationships to inner joins (which is what they truly are). And calculates the original measure. If I copy and paste this query into sql developer it runs fine but only returns those rows that joined to the time dimension - which is what was happening before. It is correct but I wanted a record for every time dimension record.
    Query 2: Looks like the following:
    select sum(0)
    from timedim
    where date between <dateprompt1> and <dateprompt2>
    group by month *<--* this is the time dimension level specified in Query 1, so it knows to aggregate to the month level as was done in query 1
    Final Question: So what is OBIEE doing ultimately, does it issue these two requests and then perform a full outer join or something to bring them together? I couldn't see anywhere in the log a complete query that I could just run to see a similar result that I was getting in Answers.
    Thanks for all the help .. Id give more points if I could.
    K

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

  • Tuning a left outer join

    Hello All,
    Good Afternoon!! Thought I will post some interesting findings of mine while I was given the task of reviewing and finding tuning scope for some complex pl/sql codes. In one of them, I found a weird way of doing a Left Outer Join against a table and they haven't used any hints typically used for joining operations (such as Ordered), but instead they used a Parallel with a table alias to the driven table, which I think is being rendered useless when it runs. This is what it looks like -
    SELECT /*+ PARALLEL(V) */ DISTINCT
             CASE WHEN y.u_dc_run_op IS NOT NULL THEN 1
             ELSE 0 END
        FROM (select 1 sw from dual) x
                LEFT OUTER JOIN
                   (SELECT V.U_DC_RUN_OPT, v.u_dc_run_pend
                      FROM dview v, u_dc_process_ctrl u
               WHERE v.u_dc_run_opt = u.opt
                AND  v.u_dc_run_pend = 1
                AND  u.process_wk = (TO_CHAR(SYSDATE,'WW') + 0)
                AND  TRIM(v.u_dc_run_opt) IS NOT NULL) y
                    On x.sw = y.u_dc_run_pend;
    Oracle is running on - Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production.
    The inner table itself is a result of another join against a 100M heavy table with another 100K light table (see below for their table definitions). Cost of the above query and Explain Plan results are as below -
    PLAN_TABLE_OUTPUT
    SQL_ID 0rpsxqtvvcmsx, child number 0
    SELECT /*+ PARALLEL(V) */ DISTINCT          CASE WHEN
    y.u_dc_run_op IS NOT NULL THEN 1          ELSE 0 END     FROM
    (select 1 sw from dual) x             LEFT OUTER JOIN
    (SELECT V.U_DC_RUN_OPT_SET, v.u_dc_run_pend FROM
    dview v, u_dc_process_ctrl u            WHERE v.u_dc_run_opt =
    u.opt AND v.u_dc_run_pend = 1             AND
    u.process_wk = (TO_CHAR(SYSDATE,'WW') + 0)             AND
    TRIM(v.u_dc_run_opt) IS NOT NULL) y On x.sw =
    y.u_dc_run_pend
    Plan hash value: 49153038
    | Id  | Operation | Name | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    | 0 | SELECT STATEMENT | |       | |  1444K(100)| |       |       |
    | 1 |  HASH UNIQUE | |     1 |    19 |  1444K  (3)| 00:01:55 | |       |
    | 2 |   NESTED LOOPS OUTER | |     1 |    19 |  1444K  (3)| 00:01:55 | |       |
    | 3 |    TABLE ACCESS FULL            | DUAL |     1 |     2 |     3   (0)| 00:00:01 |       |       |
    |* 4 |    VIEW | |     1 |    17 |  1444K  (3)| 00:01:55 | |       |
    |* 5 |     HASH JOIN | |     1 |   122 |  1444K  (3)| 00:01:55 |       |       |
    | 6 |      TABLE ACCESS BY INDEX ROWID| U_DC_PROCESS_CTRL    |     1 | 115 |     0 (0)| |       |       |
    |* 7 |       INDEX RANGE SCAN          | U_DC_PROCESS_CTRL_PK |     1 |       |     0 (0)| |       |       |
    | 8 |      PARTITION HASH ALL         |                      | 283K|  1937K|  1444K  (3)| 00:01:55 |     1 |    64 |
    |* 9 |       TABLE ACCESS FULL         | DVIEW |   283K|  1937K|  1444K  (3)| 00:01:55 |     1 |    64 |
    Predicate Information (identified by operation id):
    4 - filter("Y"."U_DC_RUN_PEND"=1)
    5 - access("V"."U_DC_RUN_OPT"="U"."OPT")
    7 - access("U"."PROCESS_WK"=TO_NUMBER(TO_CHAR(SYSDATE@!,'WW'))+0)
    9 - filter(("V"."U_DC_RUN_PEND"=1 AND TRIM("V"."U_DC_RUN_OPT") IS NOT NULL))
    SQL_ID 0rpsxqtvvcmsx, child number 1
    SELECT /*+ PARALLEL(V) */ DISTINCT          CASE WHEN
    y.u_dc_run_opt IS NOT NULL THEN 1          ELSE 0 END     FROM
    (select 1 sw from dual) x             LEFT OUTER JOIN
    (SELECT V.U_DC_RUN_OPT, v.u_dc_run_pend FROM
    dview v, u_dc_process_ctrl u            WHERE v.u_dc_run_opt =
    u.opt AND v.u_dc_run_pend = 1             AND
    u.process_wk = (TO_CHAR(SYSDATE,'WW') + 0)             AND
    TRIM(v.u_dc_run_opt) IS NOT NULL) y On x.sw =
    y.u_dc_run_pend
    Plan hash value: 49153038
    | Id  | Operation | Name | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    | 0 | SELECT STATEMENT | |       | | 1444K(100)| |       |       |
    | 1 |  HASH UNIQUE | |     1 |    19 |  1444K  (3)| 00:01:55 | |       |
    | 2 |   NESTED LOOPS OUTER | |     1 |    19 |  1444K  (3)| 00:01:55 | |       |
    | 3 |    TABLE ACCESS FULL            | DUAL |     1 |     2 | 3   (0)| 00:00:01 | |       |
    |* 4 | VIEW | |     1 |    17 |  1444K  (3)| 00:01:55 | |       |
    |* 5 |     HASH JOIN | |     1 |   122 |  1444K  (3)| 00:01:55 |       |       |
    | 6 |      TABLE ACCESS BY INDEX ROWID| U_DC_PROCESS_CTRL    |  4069 | 456K|     0 (0)|          | |       |
    |* 7 |       INDEX RANGE SCAN          | U_DC_PROCESS_CTRL_PK |     1 |       |     0 (0)| |       |       |
    | 8 |      PARTITION HASH ALL | |  5459K|    36M|  1444K  (3)| 00:01:55 |     1 |    64 |
    |* 9 |       TABLE ACCESS FULL         | DVIEW |  5459K|    36M|  1444K  (3)| 00:01:55 |     1 |    64 |
    Predicate Information (identified by operation id):
    4 - filter("Y"."U_DC_RUN_PEND"=1)
    5 - access("V"."U_DC_RUN_OPT"="U"."OPT")
    7 - access("U"."PROCESS_WK"=TO_NUMBER(TO_CHAR(SYSDATE@!,'WW'))+0)
    9 - filter(("V"."U_DC_RUN_PEND"=1 AND TRIM("V"."U_DC_RUN_OPT") IS NOT NULL))
    Note
    - cardinality feedback used for this statement
    Here's the syntax how DView and u_dc_process_ctrl tables are created -
    CREATE TABLE "A"."DVIEW"
       ( "DUNIT" VARCHAR2(50 CHAR),
      "DGROUP" VARCHAR2(50 CHAR),
      "LOC" VARCHAR2(50 CHAR),
      "U_DC_RUN_OPT" VARCHAR2(50 CHAR) DEFAULT ' ',
      "U_DC_RUN_PEND" NUMBER(1,0) DEFAULT 0
    Please note that we have DView with 64 partitions on DUNIT as a key. Approximate volume of DVIEW is about 100M.
    CREATE TABLE "A"."U_DC_PROCESS_CTRL"
       ( "PROCESS_WK" NUMBER(2,0),
      "PROCESS_LVL" VARCHAR2(10 CHAR),
      "ASSRT" VARCHAR2(50 CHAR),
      "ITEM" VARCHAR2(50 CHAR),
      "CNTRY" VARCHAR2(50 CHAR),
      "OPT" VARCHAR2(50 CHAR),
      "PROCESS_DT" DATE,
      "EXCEPTION" VARCHAR2(255 CHAR) DEFAULT ' '
    U_DC_PROCESS_CTRL is a non-partitioned table and has less than 10k records in it.
    The problem is, this apparently simple query is running for 26 minutes and I think we can avoid doing the outer join or use an ORDERED hint instead of a PARALLEL hint to the query.
    Appreciate any inputs to the above. Thanks much!!
    Thanks,
    Sanders.

    I'm looking directly at your first plan output.  The highlighted columns don't match.
    SQL_ID 0rpsxqtvvcmsx, child number 0
    SELECT /*+ PARALLEL(V) */ DISTINCT         
    CASE WHEN y.u_dc_run_op IS NOT NULL
    THEN 1         
    ELSE 0
    END    
    FROM (select 1 sw from dual) x            
    LEFT OUTER JOIN (SELECT V.U_DC_RUN_OPT_SET, v.u_dc_run_pend
    FROM    
    Forget that for now.  You say the query runs in 26 minutes.  I don't know if that's good or bad.  You're joining to a table with 100 million rows and 64 partitions and then doing a distinct on the results.  Depending on your hardware, the load, etc. that might not be too bad.
    Also...what's the business logic for this query?  The only column returned is a case statement that can only result in 0 or 1.  And then a distinct is applied to that, so at most this query can return 2 rows.  How many rows would it return without the distinct?  Joining to dual is a little weird but I guess whoever coded this wanted to guarantee at least 1 row returned.  Are the cardinality estimates correct?
    > and they haven't used any hints typically used for joining operations
    That's good.  Typically you should never use hints like this in production code.  They are poison.

  • BI 7.0 Infoset - Infocube - Left outer join - query

    Hi Expert,
    A infoset contain Infocube and ODS, linked with left outer join, common fields are PO,PO item.  PO account assignment ODS have three keyfields: PO Doc.,Item,account Assignment  .
         PO  Infocube                                     <b>PO Account Assignment ODS</b>
    PO       PO item  Amt<b>PO Doc.  Item   AccAssignment         Cost object</b>
    1000    10            230  <b>1000       10        1                          CC1</b>
    1001    10            250  <b>1002       10        1                          CC1</b>
    1002    10            150  <b>1002       10        2                          CC2</b>
    in BEx result are like this:    
    1000    10            230      1     CC1
    1001    10            250      #      #
    1002    10            150      1     CC1
    1002    10            150      2     CC2 ( amount only duplicated)
    The issue was that amount gets duplicated. It only occurs if PO has more than one account assignment.
    In report, we want show like this
    1000    10            230       1       CC1
    1001    10            250       #        #
    1002    10            150       1       CC1
    1002    10            #        2       CC2
    Any suggestion or input to overcome this issue?
    Thanks,
    Saran
    Message was edited by:
            Saravanan K

    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 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 with more than two tables in both CR 8.5 and XIR2

    I am trying to create a report and I have tried two versions of Crystal but I ultimately need the report in CR8.5 for compatibility with the client's system.  I think I am starting to figure out what might be wrong and it might be my understanding of SQL, but I can't see why someone hasn't needed this in the past. Ultimately I want to see all projects and any journal entry that might be posted for that project.
    Database is MySQL 5.0.38 and using MySQL ODBC driver 3.51.19.
    Project header table information will be populated. Each line item on a journal entry can be tagged with the project ID. But for me to pull the journal entry date I need also to link to a third table for the journal entry header info.
    I want to see all projects, whether a journal entry has been posted or not.
    So the links are like this
    ProjectHeader --->Left Outer Join ---> JELines ---> Inner Join ---> JEHeader
    I think in this scenerio Crystal is treating the LOJ as an IJ.
    I created two brand new reports today, one in CR8.5 and one in CR XIR2. Once I edited the automatic CR8.5 SQL statement (which I have been doing for years, usually without problem), they both ran properly. I linked customers to their invoices. Customers without invoices showed properly. But then I linked the invoices to the payments of the invoices and immediately lost customers without orders in both reports.
    So apparently only two tables are allowed in Outer Joins. Does this make sense?  I checked out the w3schools tutorial on SQL and it doesn't mention this limitation and I can't find anywhere else that it specifically indicates this but all samples of code I have seen only show two tables.  I just thought for presentation as a sample that was easiest to understand and we could expand as necessary.
    If this is correct, how does one go about accounting for this kind of thing?  One solution that goes through my mind is creating a view at the database level for the link between journal entry lines and journal entry headers.  Would this be a good solution under normal circumstances?
    A second option that I had to implement because of timelines, is to use a subreport linked to the main report through the project ID to pull the information for the journal entries and just pass the totals I need to the main report through a shared variable.
    These aren't normal circumstances because I don't have access to the database so I can't create the view.  I have come across this concept several times and I have been able to use subreports to solve it but I am trying to find a better solution for the future as sometimes subreports can be slow.  So are there any alternatives I have not considered here?
    TIA rasinc

    So after some more work and another post.  I was able to get this to work.
    Items disappear when linking to another table
    My issues were two fold.  I was selecting on the tables on the right-side of the original Inner Join.  However, I was checking for Nulls.  This apparently is correct but you must check for the Nulls first eg. (IsNull (JEHeader.Field1) OR JEHeader.Field1 <= 100).  I had my original statement reversed checking for <= 100 before checking for Nulls.
    I also did not set all links to be Left Outer Join.  I had the Inner Join.  I actually have about 6 tables in this report so all the links need to be set Outer Join.  So this now seems to be corrected.
    Thanks

  • Restriction to Left Outer Joins in PS Query

    Hello I am trying to do Left Outer JOin in PS QUERY. I need to do dept tbl, job code tbl and locatable as left outer joins with JOB Table. Looks like in PS QUERY there is a error message saying as below. Can someone has any workaround to achieve this in PS QUERY. I know I can create a View and use that in PS QUERY but BUsiness Users are dependent on IT, so that doesn't work. Also, adding JOB table multiple times works but I am looking for better solution if anyone had come accorss working through PS QUERY Outer JOins.
    Windows Internet Explorer
    Left outer joins must be joined to the last record in the query. (139,290)
    OK
    Thanks,
    SC.

    Hi Mike,
    According to your description, you want to improve the performance for your DAX query in SQL Server Analysis Service Tabular model, right? Here is a white paper describes strategies and specific techniques for getting the best performance from your tabular
    models, including processing and partitioning strategies, DAX query tuning, and server tuning for specific workloads.
    http://msdn.microsoft.com/en-us/library/dn393915.aspx
    Since this is a complex DAX query, from a support perspective this is really beyond what we can do here in the forums. If you cannot determine your answer here or on your own, consider opening a support case with Microsoft. Visit this link to see the various
    support options that are available to better meet your needs:
    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone
    Regards,
    Charlie Liao
    TechNet Community Support

  • Left outer join problem -- need feedback

    using crystal 2008
    haveing prolbems with a left outerjoin to get a blank field(null) to show up.
    basically i have some po line have have long descriptions or text fields that i want to include with the report. Below is my sql statement. I have written a formula with a join between 2 fields to get the report to work- this does but- it leave the polines off that do not have a long description.  I have tried left outer joins but seem to be having problems.  The long description field where the data is actually at is under my po.line table, although serveral area have long description fields -
    *one note i had to add a duplicate table to the field to get some items in my header to work properly - not sure if this is effecting the report or not.
    OK- when I set up the link to a LO join enforce from = to
    and dont add the ldtext.field to the report the left outjoin works(but no long description)and all my line items show up.
    1. when I keep the same join and add either just the ld.text field to  the report it comes back with a error saying invalid table
    2. when i use my formula that joins the ld.text and po.line and place it in the report with the same left outerjoin i get the same failure.
    3.  when i dont reference the ldtext(field) at all in the report it works fine w/ the lo join
    4. when i Dont use a left outer join and use my formula(see below)
    if not isnull(({LONGDESCRIPTION.LDTEXT }))
    then {POLINE.DESCRIPTION}+{LONGDESCRIPTION.LDTEXT}
    else {POLINE.DESCRIPTION}
    and link from poline.ld
    to ld.ldtext - my formula works and populates the po.line and the ld.text together - except that any po.line with no description will not show up. Like its not there.
    Not sure what to do?
    here is my current sql statement with the longdescription field in the select statement
    here is the error statement i am getting:
    Failed to retrieve data from the database:
    Details:42000[intersolv][odb sql base driver][sql base] 00906 itn invalid table name[database vendor code:906]
    sql statement:
    SELECT "PO"."PONUM", "PO"."STATUS", "PO"."VENDOR",
    "COMPANIES"."NAME", "COMPANIES"."ADDRESS1",
    "COMPANIES"."ADDRESS2", "COMPANIES"."ADDRESS3",
    "COMPANIES"."ADDRESS4", "COMPANIES"."PHONE",
    "COMPANIES"."FAX", "COMPANIES_1"."NAME",
    "COMPANIES_1"."ADDRESS1", "COMPANIES_1"."ADDRESS2",
    "COMPANIES_1"."ADDRESS3", "COMPANIES_1"."ADDRESS4",
    "COMPANIES_1"."CONTACT", "COMPANIES_1"."PHONE",
    "COMPANIES_1"."FAX", "PO"."PURCHASEAGENT",
    "PO"."ORDERDATE",
    "PO"."REQUIREDDATE", "PO"."PAYMENTTERMS",
    "PO"."SHIPVIA", "PO"."FREIGHTTERMS", "PO"."FOB",
    "POLINE"."DESCRIPTION", "POLINE"."ITEMNUM",
    "POLINE"."ORDERQTY", "POLINE"."UNITCOST",
    "POLINE"."LOADEDCOST", "POLINE"."POLINENUM",
    "PO"."SHIPTOATTN", "LONGDESCRIPTION"."LDTEXT"
    FROM   ("MAXIMO"."PO" "PO" LEFT OUTER JOIN
    "MAXIMO"."LONGDESCRIPTION" "LONGDESCRIPTION" ON "PO"."LDKEY"="LONGDESCRIPTION"."LDKEY"),
    "MAXIMO"."POLINE" "POLINE",
    "MAXIMO"."COMPANIES" "COMPANIES_1",
    "MAXIMO"."COMPANIES" "COMPANIES"
    WHERE  ("PO"."PONUM"="POLINE"."PONUM") AND ("PO"."VENDOR"="COMPANIES_1"."COMPANY") AND ("PO"."SHIPTO"="COMPANIES"."COMPANY") AND "PO"."PONUM"='3386-053'

    If you took the time to read this thanks.... turns out... and I just want to pull my hair out over this.  My connection had a  old odbc driver so somehow it would not allow a left outer join....go figure - weeks of agony over that..... thanks ....have to say love this forum.

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

  • Difference between merge-Not matched and left outer join

    Why should Merge-Not Matched be used instead of left outer join? I believe both will enable comparison of 2 tables. So what is the difference. Please advice.
    mayooran99

    MERGE is way to encapsulate all conditions within single statement
    The equivalent implementation using join would require three different statements 
    1 UPDATE using INNER JOIN
    1 INSERT using LEFT JOIN
    and 1 DELETE using LEFT JOIN in reverse order
    Both approaches work fine
    so all that you need to do is left join operation to find difference you can use either
    But MERGE has one additional advantage in case you need to get output from MERGE and use it for further manipulation like further insert to child table
    I've explained it here
    http://visakhm.blogspot.in/2014/09/t-sql-tips-multifaceted-merge-statement.html
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Left Outer Join on same table clarification

    HI,
    I have a table that gets populated from 3<sup>rd</sup> party system. We don’t have control over it. So, the table has master record (master) and children. Master type is 78 and children’s type is 64. So, it looks like this. In the 3<sup>rd</sup>
    party system, if Master transaction gets cancelled, it is recorded as type 178. If child is cancelled, then it is 164. Once the child is cancelled and created again using one process then newly created transaction will have 65 as type. Same thing with Master
    cancelled transaction also. It will be 79. So, to summarize:
    Master:                                                                                                                                                                      
    Brand New Transaction type = 78
    Cancelled Transaction type = 178
    Cancelled with creation transaction type = 79
    Child:
    Brand New Transaction type = 64
    Cancelled Transaction type = 164
    Cancelled with creation transaction type = 65
    I don’t have to bother about master records. I need to focus on only children for my query.
    ID
    TxnID
    Master
    Type
    TDate
    Location
    193075
    211554
    211543
    64
    20140805
    ABC
    193076
    211555
    211543
    64
    20140805
    NBC
    193077
    211556
    211543
    64
    20140805
    ABC
    193080
    211559
    211558
    64
    20140805
    ABC
    193081
    211562
    211561
    64
    20140805
    ABC
    193082
    211565
    211564
    64
    20140805
    CBC
    193083
    211565
    211564
    164
    20140805
    CBC
    193084
    211566
    211564
    65
    20140805
    AZC
    --drop
    table #Transactions
    CREATE
    TABLE #Transactions
    ID
    int,
    TxnID
    int,
    mstTicket
    int,
    Typecode
    int,
    Tdate
    datetime,
    Location
    varchar(10)
    select
    * from
    #Transactions
    Insert
    into #Transactions
    (ID,
    TxnID,
    mstTicket,Typecode,Tdate,Location)
    Select 193075, 211554,211543,64,'2014-08-05','ABC'
    UNION ALL
    Select 193076, 211555,211543, 64,
    '2014-08-05',
    'NBC' UNION ALL
    Select 193077, 211556, 211543, 64,
    '2014-08-05',
    'ABC' UNION
    ALL
    Select 193080, 211559, 211558, 64,
    '2014-08-05',
    'ABC' UNION
    ALL
    Select 193081, 211562, 211561, 64,
    '2014-08-05',
    'ABC' UNION
    ALL
    Select 193082, 211565, 211564, 64,
    '2014-08-05',
    'CBC' UNION
    ALL
    Select 193083, 211565, 211564, 164,
    '2014-08-05',
    'CBC' UNION
    ALL
    Select 193084, 211566, 211564, 65,
    '2014-08-05',
    'AZC'
    select
    T.TxnID,
    T.TypeCode,
    T.Location,
    TL.TxnID
    From
    #Transactions T
    Left Outer
    JOIN #Transactions
    TL ON
    TL.TxnID
    = T.TxnID
    and TL.TypeCode
    = 164
    select
    T.TxnID,
    T.TypeCode,
    T.Location,
    TL.TxnID
    From
    #Transactions T
    Left Outer
    JOIN #Transactions
    TL ON
    TL.TxnID
    = T.TxnID
    and TL.TypeCode
    = 164
    Where
    T.typecode
    in (64, 65)
    I need a clarification regarding left Outer Join. 
    In the first left outer join query both 64 and 164 both have TL.TxnID populated. Why is that?. What I understand from
    left outer join is that ‘Returns all the rows’ from left table and only matching data from right table.
    Here, matching row from right table is 211565 and 164 record (id 193083). So, only it should have TxnID populated. But row 211565 and 64 has TL.txnID getting populated (ID 193082).
    Why is it? Am I not understanding left out join properly?
    Thanks,

    Thank you Shailesh. I understood what join does in left outer join. I was thinking
     Left Outer JOIN #Transactions TL ON TL.TxnID = T.TxnID and TL.TypeCode = 164 is same as
    Left Outer JOIN #Transactions TL ON TL.TxnID = T.TxnID and TL.TypeCode = T.TypeCode
    and TL.TypeCode = 164
    #Transactions
    T
    Left
    Outer
    JOIN
    #Transactions
    TL
    ON
    TL.TxnID
    =
    T.TxnID
    and
    TL.TypeCode
    = 164
    Where
    T.typecode
    in
    (64,
    65)

Maybe you are looking for

  • Is there any security threat?

    Hi Group, I have my IIS webserver outside the fire wall and my coldfusion application server and SQL Server is behind the firewall . Can IIS Still access the cold fusion application server and SQL Server for coldfusion pages, is it for this situation

  • How to Add new Manual address in ADRC?

    Hello Experts, My requirement is, I want to add new address in ADRC table, once I insert new address, I will get the new ADRNR number fot that address. I want that ADRNR to link with vendor address in delivery document. Means wants to update VBPA tab

  • Domain users files sharing permission problem

    Dear Domain Professional, We have a three domain controllers  192.168.92 .162,167,150  All domain controller working with Global Catalog servers ( Root forest ) . All domain controller live synchronize with each others like Users , Group policy , ADS

  • After updating xperia c to version B.2.13

    After updating xperia c to version B.2.13 why the colour reproductipn quality degraded. All colour display seems to be faded (Edited topic - by: PaulMnhtn)

  • Publish Settings Flash .. stopping my fade effect on buttons??

    Hi there , First of all BIG thank you to Kglad for help with my last question! Secondly here is my NEW problem.... I have some buttons on my page that fade as you roll over them, and they were working fine, UNTILL i changed my Publishing Settings>Fla