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

Similar Messages

  • 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 using date range returns too many rows

    I am trying to pull data for a website.
    Names table:
    company_name varchar2(30)
    julian_day varchar2(3)
    logins number(3)
    login_errors number(3)
    Given a julian date range (e.g. 250-252), I am displaying the information from the Names table.
    The problem is that I also need to display changes (increases/decreases) in the data. I do that by coloring the text based on a 10% increase/decrease. Data for the 3 days 250-252 would be compared to data for the previous 3 days 247-249.
    Not all companies will report data on all days, so some gaps in the data may exist. Therefore, I cannot do just a simple join.
    I am trying to write a query that will give me this information if the user chooses days 250-252.
    Company_name
    sum(logins) for days 250-252
    sum(login_errors) for days 250-252
    sum(logins) for days 247-249
    sum(login_errors) for days 247-249
    The query I'm using is:
    select cur.company_name, sum(cur.logins),
    sum(cur.login_errors), sum(old.logins), sum(old.login_errors)
    FROM names cur LEFT OUTER JOIN names old
    ON cur.company_name = old.company_name
    WHERE cur.adate>='250' and cur.adate<='252'
    and old.adate>='247' and old.adate<='249'
    GROUP by cur.company_name
    Given this data:
    Company_name adate logins login_errors
    ABC 247 10 10
    ABC 248 20 20
    ABC 249 30 30
    ABC 250 15 15
    ABC 251 25 25
    ABC 252 35 35
    My problem is that it returns:
    adate cur.logins cur.login_err old.logins old.login_err
    250 15 15 60 60
    251 25 25 60 60
    252 35 35 60 60
    How can I get it to only give me the one "old" day's data? I went with the LEFT OUTER JOIN because it's possible that there is no data for an "old" day.
    Thanks in advance.....

    Your problem stems from the join itself, and would be the same even without the OUTER JOIN. With your data, there are 3 records in cur and 3 records in old. The join matches each record in cur to each record in old resulting in 9 records in total. Without the SUM, this is clear:
    SQL> SELECT cur.company_name, cur.logins, cur.login_errors,
      2         old.logins, old.login_errors, cur.adate cad, old.adate oad
      3  FROM names cur LEFT OUTER JOIN names old
      4                 ON cur.company_name = old.company_name
      5  WHERE cur.adate>=250 and cur.adate<=252 and
      6        old.adate>=247 and old.adate<=249;
    COMPANY_NA     LOGINS LOGIN_ERRORS     LOGINS LOGIN_ERRORS        CAD        OAD
    ABC                35           35         10           10        252        247
    ABC                25           25         10           10        251        247
    ABC                15           15         10           10        250        247
    ABC                35           35         20           20        252        248
    ABC                25           25         20           20        251        248
    ABC                15           15         20           20        250        248
    ABC                35           35         30           30        252        249
    ABC                25           25         30           30        251        249
    ABC                15           15         30           30        250        249
    9 rows selected.You can do this with only one reference to the table.
    SELECT company_name,
           SUM(CASE WHEN adate BETWEEN 250 and 252 THEN logins ELSE 0 END) curlog,
           SUM(CASE WHEN adate BETWEEN 250 and 252 THEN login_errors ELSE 0 END) curerr,
           SUM(CASE WHEN adate BETWEEN 247 and 249 THEN logins ELSE 0 END) oldlog,
           SUM(CASE WHEN adate BETWEEN 247 and 249 THEN login_errors ELSE 0 END) olderr
    FROM names
    WHERE adate BETWEEN 247 and 252
    GROUP BY company_nameHTH
    John

  • Display all quarters between 2 dates?

    hi,
    Is their any way to display all quarters between 2 dates.. using a SQL statement alone.. or through some function..
    If so, could some one help me around on it..
    1/1/2005 12/31/2006
    so, the answer should be..
    Q1-05
    Q2-05
    Q3-05
    Q4-05
    Q1-06
    Q2-06
    Q3-06
    Q4-06
    thanks in advance....

    Hello
    It looks slightly counter-intuitive (or atleast it did to me the first time I saw it) but you just need to pass the date columns of the table you want to generate the quarters for to the function:
    SQL> select * from dt_test_dates
      2  /
            ID START_DAT END_DATE
             1 01-JAN-05 31-DEC-06
             2 01-JAN-07 31-DEC-08
             3 01-JAN-09 31-DEC-10
    SQL> select
      2       dates.id,
      3      quarters.column_value
      4    from
      5    dt_test_dates dates,
    6 TABLE( f_ListQuartersBetween(dates.start_date,dates.end_date)
    7 ) quarters
      8  ORDER BY
      9     id
    10  /
            ID COLUMN_VALUE
             1 Q1-05
             1 Q2-05
             1 Q3-05
             1 Q4-05
             1 Q1-06
             1 Q2-06
             1 Q3-06
             1 Q4-06
             2 Q1-07
             2 Q2-07
             2 Q3-07
             2 Q4-07
             2 Q1-08
             2 Q2-08
             2 Q3-08
             2 Q4-08
             3 Q1-09
             3 Q2-09
             3 Q3-09
             3 Q4-09
             3 Q1-10
             3 Q2-10
             3 Q3-10
             3 Q4-10
    24 rows selected.It's important to note that the call to the function must come after the table that contains the dates you are interested in(at least on this version of oracle)
    SQL> select * from v$version
      2  /
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE    9.2.0.6.0       Production
    TNS for HPUX: Version 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production
    SQL> select
      2       dates.id,
      3      quarters.column_value
      4    from
      5     TABLE( f_ListQuartersBetween(dates.start_date,dates.end_date)
    6 ) quarters,
    7 dt_test_dates dates
      8  ORDER BY
      9     id
    10  /
            TABLE(  f_ListQuartersBetween(dates.start_date,dates.end_date)
    ERROR at line 5:
    ORA-00904: "DATES"."START_DATE": invalid identifierHTH
    David

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

  • Nested Left Outer Join : Data Set

    Hi All
    I am bit confused about data set used by Nested Left outer join.
    Can anyone help me.
    Here is sample data:
    Tables (Name, 3 Column each, total rows and matched rows if any):
         Table 1          
         A     B     C
         Total 20 Rows          
         Table 2          
         A     D     E
         Total 50 Rows and 10 Matching on      2.A = 1.A     
         Table 3          
         D     M     N
         Total 15 Rows and 15 Matching on 3.D = 2.D     
         Table 4          
         M     X     Y
         Total 20 Rows and 10 Matching on 4.M = 3.M     
    Sql
    select *
    From Table 1
    Left Outer Join on Table 2 on
                   2.A = 1.A
    -- Data set 1 will contain 20 Rows (10 matching and 10 non matching)
    Left Outer Join on Table 3 on
                   3.D = 2.D
    -- What will be data set? 20 Rows of Data set 1 or 15 Matching Rows?
    Left Outer Join on Table 4 on
                   4.M = 3.M
    -- What will be data set? X Rows of Data set 2 or 10 Matching Rows?
    Please have a look and clear my understanding.

    SeshuGiri wrote:
    I have two tables defined (below). Emp table has data and there is no data in Emp_Type table yet! Right now it is empty.
    I want to write a query that returns data from both the tables even though there is no data in Emp_type table. I am using left outer join but it returning nothing. Anyone can help?
    select *
    from emp e
    left outer join emp_Type t
    on e.empid = t.empid
    WHERE t.type_id = 1
    and t.end_date is null;
    The join is including all rows from emp, just like you want.
    The WHERE clause is discarding all of those rows. Since all the columns from emp_type (alias t) are NULL, the condition "t.type_id = 1" in the WHERE clause is never true.
    Perhaps you meant to include all those conditions in the join conditions, like this:
    select *
      from emp e
      left outer join emp_Type t
        on e.empid = t.empid
       and t.type_id = 1
       and t.end_date is null;Edited by: Frank Kulash on Jan 30, 2012 3:56 PM

  • Left outer join on Fact and dimension table.

    Hi all, I have a fact F with account number and few measures as columns.
    I also have a dimension D with account number, account name columns.
    Few account numbers from Fact doesnt exist in Dimension D , but they need to show up in the report though.
    How do I left join Fact and Dimension D in RPD?
    I have this report where I need to show Account Number, Account name, measures.
    If D doesnt have certain account numbers, I need to convert that account number from F as string and show it in the report in account name column.
    Can you pls help.

    Ok. I tried this:
    Driving table : Fact, Left outer join -- didnt work.
    Driving table: Dimension D left outer join -- didnt work either
    In either the case, I see physical query as D left outer Join on Fact F. and omitting the rows.
    And then I tried this -
    Driving table: Fact, RIght outer join.
    Now, this is giving me error:
    Sybase][ODBC Driver]Internal Error. [nQSError: 16001] ODBC error state: 00000 code: 30128 message: [Sybase][ODBC Driver]Data overflow. Increase specified column size or buffer size. [nQSError: 16011] ODBC error occurred while executing SQLExtendedFetch to retrieve the results of a SQL statement. (HY000)
    I checked all columns, everything matched with database table type and size.
    I am pulling Fact.account number, Dimension.account name, Fact.Measures. I am seeing this error each time I pull Fact.Account number.

  • Performance difference between left outer join / inner join

    Hi,
    I've got a complex query which among other things accesses quite a large table. If I use inner join to join this table, the response is quite fast and execution plan shows it uses nested loops to gather the data.
    If I change inner join to left outer join, I get a big performance drop. Cost of query goes from 1441 to 28544.
    I don't uderstand why there's such a difference. For inner join, database has to remove all the rows that don't have match in inner-joined table. For left join it can keep all records and just return NULL values for records that don't have a match. In my mind left join should be faster, as it seems simpler. And the access plan could be the same, couldn't it?
    Execution plan for inner join:
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 288 | 1441 (1)| 00:00:18 |
    | 1 | HASH GROUP BY | | 1 | 288 | 1441 (1)| 00:00:18 |
    | 2 | NESTED LOOPS OUTER | | 1 | 288 | 1440 (1)| 00:00:18 |
    | 3 | NESTED LOOPS | | 1 | 261 | 1438 (1)| 00:00:18 |
    | 4 | NESTED LOOPS | | 318 | 74412 | 508 (1)| 00:00:07 |
    | 5 | NESTED LOOPS | | 318 | 51834 | 189 (0)| 00:00:03 |
    | 6 | TABLE ACCESS BY INDEX ROWID| RESURCE | 1 | 106 | 1 (0)| 00:00:01 |
    |* 7 | INDEX UNIQUE SCAN | RESURCE_PRINCIPAL_NAME_INDEX | 1 | | 0 (0)| 00:00:01 |
    | 8 | TABLE ACCESS BY INDEX ROWID| TASK_USES_RESURCE | 318 | 18126 | 188 (0)| 00:00:03 |
    |* 9 | INDEX RANGE SCAN | TASK_USES_RESUR_IDX$$_0CDC0002 | 318 | | 3 (0)| 00:00:01 |
    | 10 | TABLE ACCESS BY INDEX ROWID | TASK | 1 | 71 | 1 (0)| 00:00:01 |
    |* 11 | INDEX UNIQUE SCAN | TASK_PK | 1 | | 0 (0)| 00:00:01 |
    | 12 | TABLE ACCESS BY INDEX ROWID | TASK_WORK_HISTORY | 1 | 27 | 3 (0)| 00:00:01 |
    |* 13 | INDEX RANGE SCAN | TASK_WORK_HISTORY_INDEX1 | 1 | | 2 (0)| 00:00:01 |
    | 14 | TABLE ACCESS BY INDEX ROWID | TASK_USES_RESURCE | 1 | 27 | 2 (0)| 00:00:01 |
    |* 15 | INDEX UNIQUE SCAN | TASK_USES_RESURCE_UK1 | 1 | | 1 (0)| 00:00:01 |
    For left outer join:
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 318 | 1596K| | 28544 (2)| 00:05:43 |
    |* 1 | HASH JOIN OUTER | | 318 | 1596K| 1584K| 28544 (2)| 00:05:43 |
    | 2 | VIEW | | 318 | 1580K| | 508 (1)| 00:00:07 |
    | 3 | NESTED LOOPS | | 318 | 74412 | | 508 (1)| 00:00:07 |
    | 4 | NESTED LOOPS | | 318 | 51834 | | 189 (0)| 00:00:03 |
    | 5 | TABLE ACCESS BY INDEX ROWID| RESURCE | 1 | 106 | | 1 (0)| 00:00:01 |
    |* 6 | INDEX UNIQUE SCAN | RESURCE_PRINCIPAL_NAME_INDEX | 1 | | | 0 (0)| 00:00:01 |
    | 7 | TABLE ACCESS BY INDEX ROWID| TASK_USES_RESURCE | 318 | 18126 | | 188 (0)| 00:00:03 |
    |* 8 | INDEX RANGE SCAN | TASK_USES_RESUR_IDX$$_0CDC0002 | 318 | | | 3 (0)| 00:00:01 |
    | 9 | TABLE ACCESS BY INDEX ROWID | TASK | 1 | 71 | | 1 (0)| 00:00:01 |
    |* 10 | INDEX UNIQUE SCAN | TASK_PK | 1 | | | 0 (0)| 00:00:01 |
    | 11 | VIEW | | 1480K| 73M| | 23431 (2)| 00:04:42 |
    |* 12 | HASH JOIN RIGHT OUTER | | 1480K| 76M| 38M| 23431 (2)| 00:04:42 |
    | 13 | TABLE ACCESS FULL | TASK_USES_RESURCE | 1486K| 21M| | 2938 (2)| 00:00:36 |
    | 14 | VIEW | | 1445K| 53M| | 15031 (2)| 00:03:01 |
    | 15 | HASH GROUP BY | | 1445K| 37M| 110M| 15031 (2)| 00:03:01 |
    | 16 | TABLE ACCESS FULL | TASK_WORK_HISTORY | 1445K| 37M| | 3897 (2)| 00:00:47 |
    --------------------------------------------------------------------------------------------------------------------------

    ...continued
    Complete execution plan for left join:
    | Id  | Operation                       | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |                                                                                                                                                                                  
    |   0 | SELECT STATEMENT                |                                |   318 |  1594K|       | 28544   (2)| 00:05:43 |                                                                                                                                                                                  
    |*  1 |  HASH JOIN OUTER                |                                |   318 |  1594K|  1584K| 28544   (2)| 00:05:43 |                                                                                                                                                                                  
    |   2 |   VIEW                          |                                |   318 |  1578K|       |   508   (1)| 00:00:07 |                                                                                                                                                                                  
    |   3 |    NESTED LOOPS                 |                                |   318 | 74412 |       |   508   (1)| 00:00:07 |                                                                                                                                                                                  
    |   4 |     NESTED LOOPS                |                                |   318 | 51834 |       |   189   (0)| 00:00:03 |                                                                                                                                                                                  
    |   5 |      TABLE ACCESS BY INDEX ROWID| RESURCE                        |     1 |   106 |       |     1   (0)| 00:00:01 |                                                                                                                                                                                  
    |*  6 |       INDEX UNIQUE SCAN         | RESURCE_PRINCIPAL_NAME_INDEX   |     1 |       |       |     0   (0)| 00:00:01 |                                                                                                                                                                                  
    |   7 |      TABLE ACCESS BY INDEX ROWID| TASK_USES_RESURCE              |   318 | 18126 |       |   188   (0)| 00:00:03 |                                                                                                                                                                                  
    |*  8 |       INDEX RANGE SCAN          | TASK_USES_RESUR_IDX$$_0CDC0002 |   318 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                                  
    |   9 |     TABLE ACCESS BY INDEX ROWID | TASK                           |     1 |    71 |       |     1   (0)| 00:00:01 |                                                                                                                                                                                  
    |* 10 |      INDEX UNIQUE SCAN          | TASK_PK                        |     1 |       |       |     0   (0)| 00:00:01 |                                                                                                                                                                                  
    |  11 |   VIEW                          |                                |  1480K|    73M|       | 23431   (2)| 00:04:42 |                                                                                                                                                                                  
    |* 12 |    HASH JOIN RIGHT OUTER        |                                |  1480K|    76M|    38M| 23431   (2)| 00:04:42 |                                                                                                                                                                                  
    |  13 |     TABLE ACCESS FULL           | TASK_USES_RESURCE              |  1486K|    21M|       |  2938   (2)| 00:00:36 |                                                                                                                                                                                  
    |  14 |     VIEW                        |                                |  1445K|    53M|       | 15031   (2)| 00:03:01 |                                                                                                                                                                                  
    |  15 |      HASH GROUP BY              |                                |  1445K|    37M|   110M| 15031   (2)| 00:03:01 |                                                                                                                                                                                  
    |  16 |       TABLE ACCESS FULL         | TASK_WORK_HISTORY              |  1445K|    37M|       |  3897   (2)| 00:00:47 |                                                                                                                                                                                  
    Query Block Name / Object Alias (identified by operation id):                                                                                                                                                                                                                                               
       1 - SEL$1AFB0324                                                                                                                                                                                                                                                                                         
       2 - SEL$58A6D7F6 / from$_subquery$_005@SEL$8                                                                                                                                                                                                                                                             
       3 - SEL$58A6D7F6                                                                                                                                                                                                                                                                                         
       5 - SEL$58A6D7F6 / RESURCEWORKER@SEL$2                                                                                                                                                                                                                                                                   
       6 - SEL$58A6D7F6 / RESURCEWORKER@SEL$2                                                                                                                                                                                                                                                                   
       7 - SEL$58A6D7F6 / TASKUSESRESURCE@SEL$1                                                                                                                                                                                                                                                                 
       8 - SEL$58A6D7F6 / TASKUSESRESURCE@SEL$1                                                                                                                                                                                                                                                                 
       9 - SEL$58A6D7F6 / TASK@SEL$1                                                                                                                                                                                                                                                                            
      10 - SEL$58A6D7F6 / TASK@SEL$1                                                                                                                                                                                                                                                                            
      11 - SEL$7EBCC247 / TRW@SEL$3                                                                                                                                                                                                                                                                             
      12 - SEL$7EBCC247                                                                                                                                                                                                                                                                                         
      13 - SEL$7EBCC247 / TUR@SEL$4                                                                                                                                                                                                                                                                             
      14 - SEL$6        / TRW_IN@SEL$5                                                                                                                                                                                                                                                                          
      15 - SEL$6                                                                                                                                                                                                                                                                                                
      16 - SEL$6        / TWH@SEL$6                                                                                                                                                                                                                                                                             
    Predicate Information (identified by operation id):                                                                                                                                                                                                                                                         
       1 - access("TRW"."RESURCE_ID"(+)="TASKUSESRESURCE"."RESURCE_ID" AND "TRW"."TASK_ID"(+)="TASK"."ID")                                                                                                                                                                                                      
       6 - access("RESURCEWORKER"."USER_PRINCIPAL_NAME"=U'jernej')                                                                                                                                                                                                                                              
       8 - access("TASKUSESRESURCE"."RESURCE_ID"="RESURCEWORKER"."ID")                                                                                                                                                                                                                                          
      10 - access("TASKUSESRESURCE"."TASK_ID"="TASK"."ID")                                                                                                                                                                                                                                                      
      12 - access("TUR"."RESURCE_ID"(+)="TRW_IN"."RESURCE_ID" AND "TUR"."TASK_ID"(+)="TRW_IN"."TASK_ID")                                                                                                                                                                                                         Jonathan, I've been to one of your workshops in Ljubljana. I'm still trying to understand everything you explained and use it, but there's much I have to learn and understand.
    The way I see this query it should fist join and filter the first three tables and only then join the trw subquery. The problem with this subqrey is task_work_history table, which is accessed in very different ways in different places, so there will always be many reads to gather required data. For now, however, I'd be hapy to just bring the performance of inner join to left join...

  • Left outer join using For All Entries

    how to implement left outer join using for all entries In REPORTS.

    hi Mansi,
    this is how i populate
    SELECT VGBEL LFIMG POSNR VBELN FROM LIPS INTO  TABLE IT_delv  FOR ALL ENTRIES IN IT_VBAP WHERE VGBEL = IT_VBAP-VBELN.
    LOOP AT IT_delv INTO WA_delv.
    WA_FINAL-VBELN_1 = WA_DELV-VBELN_1.
    WA_FINAL-LFDAT =   WA_DELV-LFDAT.
    WA_FINAL-LFIMG   = WA_DELV-LFIMG.
    WA_FINAL-POSNR2 =   WA_DELV-POSNR2..
    APPEND WA_FINAL TO IT_FINAL.
    CLEAR: WA_FINAL , WA_delv.
    ENDLOOP.
    LOOP AT IT_FINAL INTO WA_FINAL.
    READ TABLE IT_vbap INTO WA_vbap WITH KEY VGBEL = WA_FINAL-VBELN.
      WA_FINAL-VBELN = WA_VBAP-VBELN.
    WA_FINAL-MATNR = WA_VBAP-MATNR.
    WA_FINAL-KWMENG = WA_VBAP-KWMENG.
    WA_FINAL-NETWR = WA_VBAP-NETWR.
    MODIFY IT_FINAL FROM WA_FINAL.
    ENDLOOP.
    My question is , it_vbap has 5 five records A,B,C,D,E.
    in it_delv ,there are 20 record corrresponding to A,B,D of IT_VBAP.
    in final table i wont get info of recors B,E. I want those info also in final table ..how can i do that...

  • Data between Date Range with Business Days only

    Hi All,
    We have a requirement that we need to retrieve data between a data range, providing From date and To date as input.
    We also have the option to Include Business Days Only through a check box which will be passed to CR 2008 through a report frame work.
    Can some one help me how to display the report data within the Date Range entered and that includes only Business Days.
    Thanks in advance for the help.
    Regards,
    Naresh.

    try this formula. Lets if your date range parameter is {?date} then try this formula
    @startdate:
    if datepart('w',minimum({?date}))=7 then
    minimum({?date})+2
    else if datepart('w',minimum({?date}))=1 then
    minimum({?date})+1
    else
    minimum({?date})
    @enddate
    if datepart('w',maximum({?date}))=7 then
    maximum({?date})+2
    else if datepart('w',maximum({?date}))=1 then
    maximum({?date})+1
    else
    maximum({?date})
    regards,
    Raghavendra

  • Generating Dates Between Date Range

    Hi,
    I have a table with test_id, a_id, start_date, end_date like the below.
    test_id a_id start_date end_Date
    861 2123 05-Dec-2009 10-Dec-2009
    861 2124 06-Dec-2009 09-Dec-2009
    864 2123 08-Dec-2009 10-Dec-2009
    864 2124 07-Dec-2009 11-Dec-2009
    I need to generate dates between the start_date and end_date like the below. Kindly help.
    test_id a_id start_date end_Date tdate
    861 2123 05-Dec-2009 10-Dec-2009 05-Dec-2009
    861 2123 05-Dec-2009 10-Dec-2009 06-Dec-2009
    861 2123 05-Dec-2009 10-Dec-2009 07-Dec-2009
    861 2123 05-Dec-2009 10-Dec-2009 08-Dec-2009
    861 2123 05-Dec-2009 10-Dec-2009 09-Dec-2009
    861 2123 05-Dec-2009 10-Dec-2009 10-Dec-2009
    861 2124 06-Dec-2009 09-Dec-2009 06-Dec-2009
    861 2124 06-Dec-2009 09-Dec-2009 07-Dec-2009
    861 2124 06-Dec-2009 09-Dec-2009 08-Dec-2009
    861 2124 06-Dec-2009 09-Dec-2009 09-Dec-2009
    864 2123 08-Dec-2009 10-Dec-2009 08-Dec-2009
    864 2123 08-Dec-2009 10-Dec-2009 09-Dec-2009
    864 2123 08-Dec-2009 10-Dec-2009 10-Dec-2009
    864 2124 07-Dec-2009 11-Dec-2009 07-Dec-2009
    864 2124 07-Dec-2009 11-Dec-2009 08-Dec-2009
    864 2124 07-Dec-2009 11-Dec-2009 09-Dec-2009
    864 2124 07-Dec-2009 11-Dec-2009 10-Dec-2009
    864 2124 07-Dec-2009 11-Dec-2009 11-Dec-2009
    Please reply at the earliest. Its very urgent. Thanks in advance.
    Regards,
    Gayathri Devi

    with t
    as
    select 861 test_id, 2123 a_id, to_date('05-Dec-2009','dd-mon-yyyy') start_date, to_date('10-Dec-2009','dd-mon-yyyy') end_date from dual union all
    select 861, 2124, to_date('06-Dec-2009','dd-mon-yyyy'), to_date('09-Dec-2009','dd-mon-yyyy') from dual union all
    select 864, 2123, to_date('08-Dec-2009','dd-mon-yyyy'), to_date('10-Dec-2009','dd-mon-yyyy') from dual union all
    select 864, 2124, to_date('07-Dec-2009','dd-mon-yyyy'), to_date('11-Dec-2009','dd-mon-yyyy') from dual
    select test_id, a_id, start_date, end_date, start_date+no-1 dt
      from t
      cross join
    select level no
      from dual
    connect by level <= (select max(end_date-start_date+1) from t)
    where case when start_date+no-1 > end_date then null else start_date+no-1 end is not null
    order by 1,2,5

  • A dimension table outer join across two databases

    I have two databases of the same schema but may have different data that I would like to do comparisons on. For this discussion, each has two tables, Dimension and Fact. I created a common dimension which would show dimension data that exists on both databases. However, I want a common dimension which is a full outer join of the two Dimension tables that can be used to view data on the Fact tables on the two databases; this seems to be a little difference than a fact which may having missing value, isn't it? should this outer join occurs at the physical or logical? Can I even do it at physical if the data are from two different source? Any recommendation on what is the best way to do so? Thanks

    It depends on how you are defining your BM. Always, BM is for creating joins on folders within BM, in the sense that each folder can contain data from within multiple databases. So, create it in Physical layer and also create new joins for your defined facts dimensions in BM. But remember, cross database joins are not recommended. If both your schemas reside on 2 different oracle databases, you would be better off creating a single view (by creating a dblink between these 2 databases). So, create a single view and include that in the physical layer.
    Thanks,
    Venkat
    http://oraclebizint.wordpress.com

  • Parameter prompts-  Displaying task details between date range

    Hi all,
    I have created a report ( Crystal reports 2008) which lists task related details( distinct count) by region, customer and work type. I created two parameters to let the users specify the date ranges. Based on the user inputs, the title of the report would be " there are -- tasks between the user specified date ranges//-- and -//".  I am not sure how to go about displaying the title in the format specified.
    It would be great if you guys could give me your suggestions on this.
    Thanks a lot,
    Vinne
    Edited by: Vinnie_uic on Jun 8, 2010 9:32 AM

    Hi, I don't have 2008, but this should still work.
    You can add your text as shown.
    " there are   tasks between the user specified date ranges and  "
    Add your parameters to the report, also add a counter for your tasks.
    then you just drag and drop those into the title.
    When you edit the title it "May" look like this.
    "There are {@Count_of_Tasks}  tasks between the user specified date ranges {?Start_date} and {?End_Date} "
    but it should display as
    "There are 15  tasks between the user specified date ranges 5/20/2010  and 5/17/2010 "
    If that does not work for you, use the & sign, and create your formula like this.
    There are &" "& {@Count_of_Tasks}&" "&  tasks between the user specified date ranges &" "&{?Start_date} and&" "& {?End_Date}
    I hope the formatting is correct for 2008

  • HT204350 Trouble transferring data between laptops using Time Machine

    I am trying to migrate data from Time machine from my old MacBook to my new MacBook Air. I'm using Migration Assistant but when I connect the external hard drive that has my time machine backups on it, the new laptop doesn't appear to be reading anything. It has been plugged in for an hour and still says "looking for other sources" as if the hard drive wasn't even there.

    I had the same problem, and the reply above led me to the solution: You actually have to click the disk icon shown above the never-ending "Looking for other sources" text. Once you select the icon then you can click Continue. Hope that helps!

  • New-MailboxExportRequest - All mailboxes between defined range

    Environment: Exchange 2010, Update Rollup 6 for Exchange Server
    2010 SP1
    I am looking over the knowledge base for this cmdlet (http://technet.microsoft.com/en-us/library/ff607299.aspx) and I'm unable to determine if I can use this for all mailboxes on
    all of our databases.
    We had an issue with our mail archiving system and they were not able to capture all of the emails between 8/8/2013 and 8/14/2013. The messages are still on the exchange server for the time being. So I want to export that range into a network share in case
    anyone comes to us asking for an email between those dates. We are essentially making our own copy to "CYA."
    What I see in ever google result that uses the above command is it being used to export one mailbox. Can anyone help me with the syntax on the cmdlet to capture everyone between the dates above?

    Hello Toobar,
    Here is solution for you........
    Step 1: Add the Mailbox Import Export Role to a Role Group .
    New-ManagementRoleAssignment -Name "Import Export_YourGroupName" -SecurityGroup "YourGroupName" -Role "Mailbox Import Export"
    http://technet.microsoft.com/en-us/library/ee633452(v=exchg.141).aspx
    Step 2 :  Create the  Mailboxes.csv file , include all user's mailbox Alias in this file as below  and save in C: drive ( path may be different)
    Alias
    user1
    user2
    Step 3:   Create the Shared folder (ex -
    \\server01\PSTShare ) and grant read/write permission to the group Exchange Trusted Subsystem to the network share where you'll export  mailboxes.
    Step 4:  save file below script as Export.ps1 in C: drive ( path may be different)
    $mailboxes=import-csv c:\mailboxes.csv
    foreach($mailbox in $mailboxes)
    New-MailboxExportRequest -Mailbox $mailbox.alias -ContentFilter {(Received -lt "08/15/2013") -and (Received -gt "08/07/2013")} -FilePath "\\server01\PSTShare\$mailbox.alias.pst"
    step 5 : Go to EMS , C drive  and run the  .\export.ps1  script.
    it will export all mailbox's included in  mailboxes.csv list.
    You are done .
    Cheers  !

Maybe you are looking for

  • Large blotch appears on display

    I have an iBook G4 which Apple replaced for my G3. The G3 was part of the extended logic board program; they tried to repair it three times but were unsuccessful. I've had the G4 for less than 12 months. I've never had a problem with it until today.

  • Remote desktop and apache

    remote desktop and apache. There are times I feel that someone is looking over my shoulder, and changing my settings and controlling me. I would like to at least be able to communicate with them so I can ltarn. I also want to be able to monitor and h

  • Spry Menu Bar transparency problem - one solution

    Like many other people I have spent several frustrating days trying to solve the problem of Spry Menu Bar sub-menus appearing to be transparent (text, etc. underneath the sub-menus shows above/through the sub-menu items). This problem manifested itse

  • Is it possible to create a cc in email sending for dunning using 1040?

    Hi experts, Is it even possible to create a carbon copy of email sending using BTE 1040? I have been looking around and can't see any solution yet. Thanks.

  • Missing data in lead survey translation

    Hi everyone, I create a lead survey in transaction crm_survey_suite. After activating it I want to translate it. I login to the CRM System in the target language, translate the survey and activate the translated version. When I then choose the transl