Need Help in Joins.

Hi all,
I have some tables in my schema which are joined this way...
Product---< Policy---------< Policy_Cover_Fact-------------< Claim_Fact--------------< Claim_Payment_FactThese are the main tables, You can see three facts are joined to each other....Now, I have two calendar aliases joined to Claim_Fact table in a manner as shown below
Calendar_Open_Date_Alias-------------< Claim_Fact
Calendar_Close_Date_Alias-------------< Claim_FactMy problem is when I import these all tables from Physical to BMM, as there are fact to fact joins, the fact tables are not shown in Yellow color (the icon which should normally come).
Also, When I right click any of the calendar_alias table and click dimension, the dimension Hierarchy of Claim_Fact gets created.
I am a bit confused how should I solve this problem. Can it be solved by creating alias of the fact tables, if so, how should it be done, and how the LTS should be created?

Your number one goal should be to create a star schema in the business model, anything else can cause you problems.
I would personally import the Phyiscal tables without the joins (from any FK's defined) and then create aliases for each, joining manually as required.
I would also create the Business Model from scratch which gives me greater control of the attributes and data sources selected, creating the 3 fact tables with alias joins to each of the dimensions. You can also create alias dimensions for the facts tables, if they have dimension attributes.
I'd also personally look at removing the product ---< policy snowflake (assuming these are both dimension tables).
So goal would be:
ProductPolicy ---< Policy Cover Fact >----- Dim_Policy Cover Fact
ProductPolicy ---< Claim Fact >---- Dim_Claim Fact
ProductPolicy ---< Claim Payment Fact >---- Dim_Claim Payment Fact
It may also be possible to combime the physical fact tables into a single logical fact table....

Similar Messages

  • Need help on join query

    Hi All,
    Please help me on the below join condition,
    >SELECT * FROM ESTIMATE_LINE WHERE JOB_ID = '214582' AND ESTIMATE_ID = 2;
    Output : Returns 1 row,
    >SELECT * FROM ESTIMATE_ACCOUNTING_LINE WHERE JOB_ID = '214582' AND ESTIMATE_ID = 2;
    Output : Returns 3 rows,
    I would like to add these two outputs as on, Finally i've to get 4 rows in the output,
    For that am writing the query like this,
    SELECT EL.*,EAL.*
    FROM ESTIMATE_LINE EL,
    ESTIMATE_ACCOUNTING_LINE EAL
    WHERE EL.JOB_ID = EAL.JOB_ID (+)
    AND EL.ESTIMATE_ID = EAL.ESTIMATE_ID (+)
    AND EAL.JOB_ID = '214582'
    AND EL.ESTIMATE_ID = 2,
    It is not giving the exact output, the common fields are there in the join condition,
    Can some one please re write the query for expected output..
    I am trying it but not getting the exact output,Unable to find out where the mistake is ...
    Thanks,
    gra

    Hi,
    First, let me make sure I undersatnd the problem.
    You have a query that lookas for information about a given job_id and estimate_id the estimate_line table. This query produces X rows.
    You have another query that lookas for information about the same job_id and estimate_id the estimate_accounting__line table. This query produces Y rows.
    You want to get the same results in one query that produces X+Y rows.
    That sounds like a job for UNION, not a join.
    If the two queries produces the same number of columns, and the data types of the columns are similiar, then you can just write the two queries together. Instead of a semicolon at the end of the first query, you'll say UNION (or UNION ALL):
    SELECT * FROM ESTIMATE_LINE            WHERE JOB_ID = '214582' AND ESTIMATE_ID = 2
    UNION ALL
    SELECT * FROM ESTIMATE_ACCOUNTING_LINE WHERE JOB_ID = '214582' AND ESTIMATE_ID = 2;If the columns are not the same, you'll need to call some conversion functions, or add literal columns (such as NULL) to the queries.
    If you need help, post a little sampe data (CREATE TABLE and INSERT statements) and the results you want from that data.

  • Need Help on Joining multiple tables in Golden Gate

    Hi,
    Can you please help me with some examples on joining multiple tables in Golden Gate. i.e, my requirement is to Join Table 1 & Table 2 in Source and Load it in Target with 10 fields from Table 1 & 5 fields from Table 2 based on the join condition between Table 1.key = Table2.key
    I have been trying to do that using SQLEXEC command in Golden Gate. But, is there a way I can do this in the Extract parameter file?
    Thanks for your time
    Regards
    Suresh

    Hi,
    Thanks a lot for the prompt reply. I am able to do that for the below scenario
    Source.T1.Field1
    Source.T1.Field2
    Source.T2.Field1
    Source.T2.Field2
    Target Table
    T1.Field1, T1.Field2, T2.Field1, T2.Field2.
    But, if I already have T2.Field1 in T1 table, then T1.Field1 takes the precendence and getting loaded. i.e., I wanted to join the table 1 & Table 2 and based on the matching condition, I will need to populate the data either from T1 or T2.
    Hope you got my requirement.
    Below the Data Dump file & Replicat File.
    EXTRACT dpump
    USERID ********, PASSWORD ********
    RMTHOST *******, MGRPORT 7809
    RMTTRAIL /oracle/gg/dirdat/rt
    --PASSTHRU
    TABLE TABLE1,
    SQLEXEC (ID LOOKUP,
    QUERY "SELECT FIELD1 FROM SOURCE.TABLE2 WHERE FIELD1 = :v_field1",
    PARAMS ( v_field1 = field1 )),
    TOKENS (tk_field_1 = @GETVAL (lookup.field1));
    Replicat file
    REPLICAT repjoin
    ASSUMETARGETDEFS
    HANDLECOLLISIONS
    USERID *******, PASSWORD ********
    MAP SOURCE.T1, TARGET TARGET.GG_TABLE_T1,
    COLMAP ( USEDEFAULTS ,
    field1 = @token ("tk_party_id"));
    I eventually wanted to join like below.
    select t1.field1, t1.field2, t2.field1 from t1, t2
    where t1.field1 = t2.field1;
    Thanks for your time again
    Regards
    Suresh

  • Need help with join

    Extract each entry from BSEG for BELNRs in BKPF-BELNR,
    and KOSTL in ZTABLE-KOSTL.
    sum(DMBTR) by KOSTL into
    internal tab <ITAB (fields KOSTL, DMBTR)>.
    i wrote the code like this:
    Select sum( aDMBTR ) aKOSTL into inkostltotal from BSEG as a
    inner join BKPF as b on bBELNR = aBELNR
    inner join Ztable as c on c~KOSTL = a-KOSTL
    group by a~KOSTL.
    it was giving error:
    You cannot use comparisons with column column references in pool and
    cluster tables: "A~BELNR". column references in pool and cluster
    tables: "A~BELNR". column references in pool and cluster tables:
    "ABELNR". column tables: "ABELNR".
    i need to use select, sum, group by to solve this can some one
    help me with this.

    hi saritha,
                   y ur not using for all entries, that will best in this situation.
    use for all entries like that
    CLEAR : T_EQUZ,T_EQUZ[].
    SELECT * FROM EQUZ INTO TABLE T_EQUZ
                       WHERE DATBI = '99991231'.
    IF NOT T_EQUZ[] IS INITIAL.
      select J_3GBELNRI equnr J_3GEMPFAE into
           corresponding fields of table
           T_J_3GBELP from J_3GBELP
           FOR ALL ENTRIES IN T_EQUZ
           where j_3guposnr ne '1'
           and J_3GEMPFAE in Reciver
           and equnr = T_EQUZ-EQUNR.
    regards
    vijay dwivedi
    rewards if usefull

  • Need help in Join statements

    Need to join these tables EKPO(Purchasing Doc Item), EKET(Scheduling Agreement Schedule line), MAKT(Material Desc), LIPS(SD Doc: Delivery Item data) tables.
    The fields that EKPO has is ebeln,ebelp,matnr,menge, meins
    The fields that EKET has is ebeln,ebelp,etenr,dat01.
    The fields that MAKT has is matnr,spras,makts.
    The fields that LIPS has is vbeln,posnr,matnr,vgpos,erdat,vrkme,lfimg.
    The output needs to as
    ebeln from table ekpo-ebeln
    ebelp from table lips-vgpos
    matnr from table ekpo-matnr
    menge from table ekpo-menge
    meins from table ekpo-meins
    vrkme from table lips-vrkme
    vbeln from table lips-vbeln
    lfimg from table lips-lfimg
    erdat from table lips-erdat
    dat01 from table eket-dat01
    maktx from table makt-maktx
    The selection screen has ekpo-ebeln and eket-dat01 as select-options
    and parameters as ekpo-bukrs and ekpo-werks.
    Please suggest as to how to write this join with the above tables.

    Hi,
    I tried joining your tables using inner join. Here is sample code which I have written.
    REPORT  ZAM_TABLEJOIN.
    tables: ekpo,eket,makt,lips.
    select-options: s_ebeln for ekpo-ebeln,
                    s_dat01 for eket-dat01.
    parameters: p_bukrs type ekpo-bukrs,
                p_werks type ekpo-werks.
    types: begin of itabtype,
    ebeln type ekpo-ebeln,
    ebelp type lips-vgpos,
    matnr type ekpo-matnr,
    menge type ekpo-menge,
    meins type ekpo-meins,
    vrkme type lips-vrkme,
    vbeln type lips-vbeln,
    lfimg type lips-lfimg,
    erdat type lips-erdat,
    dat01 type eket-dat01,
    maktx type makt-maktx,
    end of itabtype.
    data: itab type standard table of itabtype,
          wa like line of itab.
    SELECT a~ebeln
    d~vgpos
    a~matnr
    a~menge
    a~meins
    d~vrkme
    d~vbeln
    d~lfimg
    d~erdat
    b~dat01
    c~maktx
    FROM ekpo AS a
    INNER JOIN eket AS b
    ON aebeln EQ bebeln AND aebelp EQ bebelp
    INNER JOIN makt AS c
    ON amatnr EQ cmatnr
    INNER JOIN lips AS d
    ON amatnr EQ dmatnr
    INTO TABLE itab
    WHERE aebeln IN s_ebeln AND bdat01 IN s_dat01 AND a~bukrs EQ p_bukrs
    AND a~werks EQ p_werks.
    loop at itab into wa.
    write: / wa-ebeln, wa-ebelp,wa-matnr,wa-menge, wa-meins, wa-vrkme,
    wa-vbeln, wa-lfimg, wa-erdat, wa-dat01, wa-maktx.
    endloop.
    Hope this helps you. Please correct me if there is anything wrong in this code.
    Reward All Helpful Answers!!!!
    Sunny

  • 3d Games - need help just joined

    Hello there, I have just joined this forum and am wondering where to start. I downloaded a 3d engine yesterday called 3DzzD although I didn't find it that useful. Could anyone point me in the right direction as to what I need to download etc so that I can make my own 3d game using the java script?
    Much appreciated,
    Mr.Clym
    Ps: I have never used Java script before, Although I have used other different codes before, is there some tutorials that I could read to find out about scripting in java3d?
    Message was edited by:
    Mr.Clym

    Ok, thx for your help but could you give me a link to
    a java script forum? and a link to the game forum? as
    I said I am very new to java
    Message was edited by:
    Mr.Clym
    JavaScript forums:
    http://www.google.com/search?hl=en&q=javascript+forum&btnG=Google+Search
    Java game-section of this forum:
    http://forum.java.sun.com/forum.jspa?forumID=406
    Difference between Java and JavaScript:
    http://www.developer.com/java/other/article.php/639301

  • Need help to join two tables using three joins, one of which is a (between) date range.

    I am trying to develop a query in MS Access 2010 to join two tables using three joins, one of which is a (between) date range. The tables are contained in Access. The reason
    the tables are contained in access because they are imported from different ODBC warehouses and the data is formatted for uniformity. I believe this cannot be developed using MS Visual Query Designer. I think writing a query in SQL would be suiting this project.
    ABCPART links to XYZPART. ABCSERIAL links to XYZSERIAL. ABCDATE links to (between) XYZDATE1 and ZYZDATE2.
    [ABCTABLE]
    ABCORDER
    ABCPART
    ABCSERIAL
    ABCDATE
    [ZYXTABLE]
    XYZORDER
    XYZPART
    XYZSERIAL
    XYZDATE1
    XYZDATE2

    Thank you for the looking at the post. The actual table names are rather ambiguous. I renamed them so it would make more sense. I will explain more and give the actual names. What I do not have is the actual data in the table. That is something I don't have
    on this computer. There are no "Null" fields in either of the tables. 
    This table has many orders (MSORDER) that need to match one order (GLORDER) in GLORDR. This is based on MSPART joined to GLPART, MSSERIAL joined to GLSERIAL, and MSOPNDATE joined if it falls between GLSTARTDATE and GLENDDATE.
    [MSORDR]
    MSORDER
    MSPART
    MSSERIAL
    MSOPNDATE
    11111111
    4444444
    55555
    2/4/2015
    22222222
    6666666
    11111
    1/6/2015
    33333333
    6666666
    11111
    3/5/2015
    This table has one order for every part number and every serial number.
    [GLORDR]
    GLORDER
    GLPART
    GLSERIAL
    GLSTARTDATE
    GLENDDATE
    ABC11111
    444444
    55555
    1/2/2015
    4/4/2015
    ABC22222
    666666
    11111
    1/5/2015
    4/10/2015
    AAA11111
    555555
    22222
    3/2/2015
    4/10/2015
    Post Query table
    GLORDER
    MSORDER
    GLSTARTDATE
    GLENDDATE
    MSOPNDATE
    ABC11111
    11111111
    1/2/2015
    4/4/2015
    2/4/2015
    ABC22222
    22222222
    1/5/2015
    4/10/2015
    1/6/2015
    ABC22222
    33333333
    1/5/2015
    4/10/2015
    3/5/2015
    This is the SQL minus the between date join.
    SELECT GLORDR.GLORDER, MSORDR.MSORDER, GLORDR.GLSTARTDATE, GLORDR.GLENDDATE, MSORDR.MSOPNDATE
    FROM GLORDR INNER JOIN MSORDR ON (GLORDR.GLSERIAL = MSORDR.MSSERIAL) AND (GLORDR.GLPART = MSORDR.MSPART);

  • Need help in joins in OBIEE 10G

    Hi All,
    I have 2 tables like following.
    Table 1: Team
    Id| Team Name| Resource id
    1 | xxx | 1
    2 | yyy | 1
    3 | zzz | 1
    4 | xxx | 2
    Table 2: Resource Rate
    RSRC ID| Resource Name| Rate | Month | year
    1 | John | 10 | Jan | 2012
    2 | Max | 5 | Jan | 2012
    I have joined these 2 tables with Resource ID. I have a prompt with Team Name and Resource Name and I have a OBIEE chart report (Month,Year Vs Rate), in which if do not select team name in prompt or select only one team name then the results are fine but when i select 2 team names in the prompt for example 'xxx','yyy' the results gets doubled. If I select 3 team names, the result will be rate*3. But I want the result to be same value even after I select more than one team name.
    How to archive this??? Kindly help
    Edited by: GJ on Sep 10, 2012 10:39 PM
    Edited by: GJ on Sep 10, 2012 11:53 PM

    Hi Veeravalli,
    No I cannot have team name after resource name, because the purpose is to see based on team and then on resource. Moreover their is nothing wrong with queries generated, it is working as it is expected, Since the resource is mapped to 2 teams, I am getting duplicate values.
    I am just trying to find if there is a way to return always unique values.

  • Need help in joining the following tables!

    send me the query for how to join the fields from the tables given.
    Important thing is i need all the values of vbeln in output.
    Whether its corresponding values in other fields present or not doesnt matter
            VBELN LIKE VBAK-VBELN,
             VKORG LIKE VBAK-VKORG,
             ERDAT LIKE VBAK-ERDAT,
             AUGRU LIKE VBAK-AUGRU,
             BEZEI LIKE TVAUT-BEZEI,
             BSTDK LIKE VBKD-BSTDK,
             BSTDK_E LIKE VBKD-BSTDK_E,
             BSTKD LIKE VBKD-BSTKD,
             KDKG2 LIKE VBKD-KDKG2,
             KONDA LIKE VBKD-KONDA,
             MATNR LIKE VBAP-MATNR,
             SPART LIKE VBAP-SPART,
             KONDM LIKE VBAP-KONDM,
             WAERK LIKE VBAP-WAERK,
             NETWR LIKE VBAP-NETWR,
             KWMENG LIKE VBAP-KWMENG,
             VKAUS LIKE VBAP-VKAUS,
             MVGR1 LIKE VBAP-MVGR1,
             MVGR2 LIKE VBAP-MVGR2,
             MVGR3 LIKE VBAP-MVGR3,
             MVGR4 LIKE VBAP-MVGR4,
             MVGR5 LIKE VBAP-MVGR5,
             KUNNR LIKE VBPA-KUNNR,
             POSTCODE1 LIKE ADRC-POST_CODE1,
             POBOX LIKE ADRC-PO_BOX,
             NAME1 LIKE ADRC-NAME1,
             NAME2 LIKE ADRC-NAME2,
             CITY1 LIKE ADRC-CITY1,
             CITY2 LIKE ADRC-CITY2,
             COUNTRY LIKE ADRC-COUNTRY,
             STREET LIKE ADRC-STREET,
             STRSUPPL1 LIKE ADRC-STR_SUPPL1,
             STRSUPPL2 LIKE ADRC-STR_SUPPL2,
             STRSUPPL3 LIKE ADRC-STR_SUPPL3,
             NRART LIKE TPAR-NRART,
             VTEXT1 LIKE TPART-VTEXT,
             PARVW LIKE TPART-PARVW,
             BEZE_I LIKE TVLVT-BEZEI,
             VTEXT LIKE V_T178-VTEXT,
             V_TEXT like V_T188-VTEXT,
             BEZEI1 LIKE TVM1T-BEZEI,
             BEZEI2 LIKE TVM2T-BEZEI,
             BEZEI3 LIKE TVM3T-BEZEI,
             BEZEI4 LIKE TVM4T-BEZEI,
             BEZEI5 LIKE TVM5T-BEZEI,
             VTEXT2 LIKE TVKGGT-VTEXT,
             SMTP_ADDR LIKE ADR6-SMTP_ADDR,

    hi there,
    i want to fetch data from all the fields i ahve given here .It will be a join statement.
    the important thing is I need all the values of vbeln in leftside
    as output.

  • Need help please, Join Tracks Greyed Out.

    Can someone please help with ther following information.
    When I want to burn an audiobook from CD into itunes and try to use the "join tracks" command from the advanced menu it is greyed out and can't be used.
    Can someone please tell me how to sort this out, plus as soon as I load i CD itune starts to import even though I have it set in preff not to do so.
    Again any help please to stop this happening.
    Many thanks

    *When I want to burn an audiobook from CD into itunes and try to use the "join tracks" command from the advanced menu it is greyed out and can't be used.*
    Are you highlighting the tracks you want to join before you go to Advanced>Join CD tracks? the function will be dimmed until a selection is made.
    *as soon as I load i CD itune starts to import even though I have it set in preff not to do so.*
    Open iTunes and go to Edit>Preferences>Advanced>Importing and change the setting in the drop down menu beside "On CD insert" from "Import CD" to one of the other settings such as "Show CD", "Begin Playing" or "Ask to Import CD"

  • Need help in join

    hi,
    Following are my columns data in same table,
    Value1 Value2
    1 1
    2 2
    3 4
    1 3
    My output sould be as like follows
    value
    1
    2
    3
    4
    so please help me on this logc by proving sample query

    Hey or in other way i will explain my requirment,
    i have two reslutset,
    result set A and result set b. i want to join both the result set and bring the output as follows.
    resultA
    1
    2
    3
    1
    resultB
    1
    2
    3
    4
    ned to join these two results and bring the out put as follows
    result:
    1
    2
    3
    4
    i given my requirement in last post bit wrongly, the above requirement is correct. can u pls help me now

  • Need help tuning join in slow query

    Hi all,
    I have the following issue to tune the below join condition in my query below:
    SELECT PO.COMPANY,
    PO.UPDATE_DATE,
    PO.EXTENDED_AMT,
    PO.LOCATION,
    ICLOCATION.R_NAME AS LOCATION_DESC,
    PO.VENDOR,
    AP.VENDOR_VNAME,
    MAJOR.DESCRIPTION AS MAJOR_DESC,
    MINOR.DESCRIPTION AS MINOR_DESC,
    CASE po.purch_majcl
    WHEN ' '
    THEN 'NONE'
    ELSE po.purch_majcl
    END AS PURCH_MAJ,
    CASE po.purch_min
    WHEN ' '
    THEN 'NONE'
    ELSE po.purch_min
    END AS PURCH_MIN,
    CASE po.manuf_code
    WHEN ' '
    THEN 'NO MFG'
    ELSE po.manuf_code
    END AS MANUF_CODE,
    CASE po.manuf_nbr
    WHEN ' '
    THEN 'NONE'
    ELSE po.manuf_nbr
    END AS MANUF_NBR,
    CASE po.manuf_division
    WHEN ' '
    THEN 'NONE'
    ELSE po.manuf_division
    END AS MANUF_DIV,
    CASE po.agreement_ref
    WHEN ' '
    THEN 'NONE'
    ELSE PO.AGREEMENT_REF
    END AS AGRMT_REF,
    /* ITEMLOC IS REQUIRED TO GET TO ICCACATEGORY */
    CASE po.item_type
    WHEN 'I'
    THEN ICCATEGORY.INV_ACCT_UNIT
    ELSE MMDIST.ACCT_UNIT
    END AS ACCT_UNIT,
    CASE po.item_type
    WHEN 'I'
    THEN ICCATEGORY.GL_CATEGORY
    ELSE to_char(MMDIST.ACCOUNT)
    END AS ACCOUNT,
    /* ITEMLOC IS REQUIRED TO GET TO ICCACATEGORY */
    PO.ITEM_TYPE,
    PO.ITEM,
    PO.DESCRIPTION AS ITEM_DESC,
    PO.ENT_REC_UOM,
    PO.ENT_RUOM_MULT,
    PO.ENT_REC_QTY,
    PO.ORIG_UNIT_CST,
    PO.MATCH_UNIT_CST,
    PO.PO_NUMBER,
    PO.PO_LINE_NBR,
    PO.QTY_TO_PROC,
    PURCHORDER.PO_DATE,
    PURCHORDER.BUYER_CODE,
    BUYER.R_NAME AS BUYER_NAME
    FROM LAW.PURCHORDER, LAWS81.BUYER,
    LAW.ICLOCATION, LAW.APVENMAST,
    LAW.PO LEFT JOIN LAW.MMDIST
    ON (PO.COMPANY = MMDIST.COMPANY
    AND PO.LOCATION = MMDIST.LOCATION
    AND PO.PO_NUMBER = MMDIST.DOC_NUMBER
    AND PO.PO_RELEASE = MMDIST.DOC_NBR_NUM
    AND PO.PO_CODE = MMDIST.PO_CODE
    AND PO.PO_LINE_NBR = MMDIST.LINE_NBR
    AND MMDIST.SYSTEM_CD = 'PO'
    AND MMDIST.DOC_TYPE = 'PT'
    AND MMDIST.COMPONENT_SEQ = 0
    AND MMDIST.AOC_CODE = ' ')
    /* 1st JOIN TO ITEMLOC */
    LEFT JOIN LAW.ITEMLOC
    ON PO.COMPANY = ITEMLOC.COMPANY
    AND PO.LOCATION = ITEMLOC.LOCATION
    AND PO.ITEM = ITEMLOC.ITEM,
    /* 2nd JOIN from ITEMLOC to ICCATEGORY */
    /* It should use the ITEMLOC join from above */
    /* creating cartesian product with itemloc */
    LAW.ITEMLOC LEFT JOIN LAW.ICCATEGORY
    ON ITEMLOC.COMPANY = ICCATEGORY.COMPANY
    AND ITEMLOC.LOCATION = ICCATEGORY.LOCATION
    AND ITEMLOC.GL_CATEGORY = ICCATEGORY.GL_CATEGORY,
    /* need to get to ICCATEGORY table using 2nd JOIN condition above */
    LAW.PO LEFT JOIN LAW.MAJOR
    ON PO.PURCH_MAJ = MAJOR.MAJOR_CLASS
    AND MAJOR.CLASS_TYPE = 'P'
    LEFT JOIN LAW.MINOR
    ON PO.PURCH_MAJCL = MINOR.MAJOR_CLASS
    AND PO.PURCH_MINCL = MINOR.MINOR_CLASS
    AND MINOR.CLASS_TYPE = 'P'
    WHERE PO.COMPANY = PO.COMPANY
    AND PO.PO_NUMBER = PO.PO_NUMBER
    AND PO.PO_RELEASE = PO.PO_RELEASE
    AND PO.PO_CODE = PO.PO_CODE
    AND PO.PO_LINE_NBR = PO.LINE_NBR
    AND PO.COMPANY = ICLOCATION.COMPANY
    AND PO.LOCATION = ICLOCATION.LOCATION
    AND PO.VENDOR = APVENMAST.VENDOR
    AND PO.COMPANY = PURCHORDER.COMPANY
    AND PO.PO_CODE = PURCHORDER.PO_CODE
    AND PO.PO_NUMBER = PURCHORDER.PO_NUMBER
    AND PO.PO_RELEASE = PURCHORDER.PO_RELEASE
    AND PURCHORDER.BUYER_CODE = BUYER.BUYER_CODE
    AND PO.R_STATUS = 1
    AND PO.ENT_REC_QTY > 0
    This query runs very slow and we cannot change the code to add or modify indexes. We need to join the 2nd table to the third table with optimized performance. How can I tune this slow running query with the best join conditions?
    Thanks

    I want to join the OS_LOCN_CURR_STK table with the
    OT_PO_ITEM table , such that all items in
    OS_LOCN_CURR_STK are displayed.
    If you want all items in OS_LOCN_CURR_STK to be returned, use an OUTER JOIN on the columns joining the 2 tables.

  • I need help I cant connect on wifi just "unable to join the network"

    I have problem to my WiFi connection
    I cant connect on WiFi home
    and i have MSG unable to join the network
    but my Iphone this is old iPhone 3
    I need help how can I fix it and i don't know if my phone or the router the problem.
    Pls help give me a easy answer and how i solve it.

    Hello, thanks for your answer, I try that reset, nothing change but my WiFi router when I off it my WiFi it is back after a minute my WiFi it doesn't  work again. I think my router WiFi is the problem because I try everything apple community they suggestion still not working.

  • Need help in creating a chart from 3 datasets

    Need help in creating a chart in SSRS from 3 datasets
    Can someone help me in creating a chart from 3 datasets, however datasource is same.

    Thank you Olaf...
    could anyone help me in using union all with the below
     WITH a AS (
    SELECT
    clientid,
    DATEPART(year, row_date) AS 'Year',
    DATEPART(month, row_date) AS 'Month',
        value ,
        CASE metricid WHEN 16 THEN 'FCR' ELSE 'Cases' END AS metric
    FROM XXXXXX AS V
    WHERE metricid IN (16, 11)
    AND row_date BETWEEN '2012-01-01' AND '2014-10-01'
    AND value IS NOT NULL)
    , b AS (
    SELECT     clientid ,
        Year ,
        Month ,
        value AS 'Cases',
        metric 
    FROM a
    WHERE metric = 'cases')
    , c AS (
    SELECT     clientid ,
        Year ,
        Month ,
        value AS 'FCR',
        metric  
    FROM a
    WHERE metric = 'FCR')
    , d AS (
    SELECT b.YEAR, b.MONTH, c.FCR, b.Cases 
    FROM b INNER JOIN c 
    ON c.clientid = b.clientid
    AND c.[YEAR] = b.[year] 
    AND c.[month] = b.[month]
    WHERE c.fcr <> 0 AND b.cases <> 0
    ,E AS (
    SELECT [Year], [Month], SUM(FCR) AS FCR, SUM(Cases) AS Cases
    FROM d
    GROUP BY [Year], [Month])
    select YEAR, MONTH, 
    CASE MONTH 
    WHEN 1 THEN 'Jan'
    WHEN 2 THEN 'Feb'
    WHEN 3 THEN 'Mar'
    WHEN 4 THEN 'Apr'
    WHEN 5 THEN 'May'
    WHEN 6 THEN 'Jun'
    WHEN 7 THEN 'Jul'
    WHEN 8 THEN 'Aug'
    WHEN 9 THEN 'Sep'
    WHEN 10 THEN 'Oct'
    WHEN 11 THEN 'Nov'
    WHEN 12 THEN 'Dec'
    END AS MonthName
    ,e.FCR AS FCRCases
    ,e.Cases AS TotalCases
    ,CASE 
    WHEN [month] IN (11, 12, 1) THEN 1
    WHEN [month] IN (2, 3, 4) THEN 2
    WHEN [month] IN (5, 6, 7) THEN 3
    WHEN [month] IN (8, 9, 10) THEN 4
    END AS 'Quarter'
    --,CONVERT(DECIMAL(18, 2),(e.FCR/e.Cases)*100) AS FCRRaw
    from e
    order by YEAR, MONTH
    **************2nd query*************
    WITH a AS (
    SELECT
    clientid,
    DATEPART(year, row_date) AS 'Year',
    DATEPART(month, row_date) AS 'Month',
        value, 
        CASE metricid WHEN 56 THEN 'numerator' ELSE 'denominator' END AS metric
    FROM XXXXXXX.[Values] AS V
    WHERE metricid IN (56, 10)
    --WHERE metricid IN (11,16)
    AND row_date BETWEEN '2013-10-01' AND '2014-02-01'
    AND value IS NOT NULL)
    , b AS (
    SELECT     clientid ,
        Year ,
        Month ,
        value AS 'numerator',
        metric
    FROM a
    WHERE metric = 'numerator')
    , c AS (
    SELECT     clientid ,
        Year ,
        Month ,
        value AS 'denominator',
        metric
    FROM a
    WHERE metric = 'denominator')
    , d AS (
    SELECT b.YEAR, b.MONTH, c.denominator, b.numerator 
    FROM b INNER JOIN c 
    ON c.clientid = b.clientid
    AND c.[YEAR] = b.[year] 
    AND c.[month] = b.[month]
    WHERE c.denominator <> 0 AND b.numerator <> 0
    , e AS (
    SELECT [Year], [Month], SUM(numerator) AS numerator, SUM(denominator) AS denominator
    FROM d
    GROUP BY [Year], [Month]
    SELECT *, 
    CASE 
    WHEN [month] IN (11, 12, 1) THEN 1
    WHEN [month] IN (2, 3, 4) THEN 2
    WHEN [month] IN (5, 6, 7) THEN 3
    WHEN [month] IN (8, 9, 10) THEN 4
    END AS 'Quarter'
    FROM e
    ORDER BY 1,2
    ******************3rd query**************
    WITH a AS (
    SELECT --L.[LocationGroupId],
    -- T.locationid,
    -- T.AccountId,
    TR.datestamp,
    /*Convert(NVARCHAR, DatePArt(year, TR.datestamp)) + '-' + Convert(NVARCHAR, DatePArt(month, TR.datestamp)) + '-01'*/ 
    TR.Period AS ValueDate,
    CASE WHEN TR.TargetResultState = 0 THEN 0 WHEN TR.TargetResultState = 1 THEN 1 WHEN TR.TargetResultState = 2 THEN 1 ELSE 0 END AS Met,
    CASE WHEN CONVERT(DATE, Convert(NVARCHAR, DatePArt(year, TR.datestamp)) + '-' + Convert(NVARCHAR, DatePArt(month, TR.datestamp)) + '-01') > T.Startdate AND CONVERT(DATE, Convert(NVARCHAR, DatePArt(year, TR.datestamp))
    + '-' + Convert(NVARCHAR, DatePArt(month, TR.datestamp)) + '-01') < T.Enddate THEN 1 ELSE 0 END AS ActiveTarget
    FROM XXXXXX AS TR
    INNER JOIN dbo.Target T ON TR.TargetID = T.ID
    --INNER JOIN dbo.Location L ON T.Locationid = L.Id
    WHERE --locationid <> - 1 AND 
    TR.Period IN ('201306', '201307', '201308', '201309', '201310', '201311', '201312', '201401'))
    select ValueDate, SUM(Met) AS Met, Count(ActiveTarget) AS ActiveTargets,
    right(ValueDate,2) as Month
    ,left(ValueDate,4) as Year
    ,CASE 
    WHEN right(ValueDate,2) IN (11, 12, 1) THEN 1
    WHEN right(ValueDate,2) IN (2, 3, 4) THEN 2
    WHEN right(ValueDate,2) IN (5, 6, 7) THEN 3
    WHEN right(ValueDate,2) IN (8, 9, 10) THEN 4
    END AS 'Quarter'
    from a
    group by ValueDate
    order by ValueDate

  • Need help with INSERT and WITH clause

    I wrote sql statement which correctly work, but how i use this statment with INSERT query? NEED HELP. when i wrote insert i see error "ORA 32034: unsupported use of with clause"
    with t1 as(
    select a.budat,a.monat as period,b.vtweg,
    c.gjahr,c.buzei,c.shkzg,c.hkont, c.prctr,
    c.wrbtr,
    c.matnr,
    c.menge,
    a.monat,
    c.zuonr
    from ldw_v1.BKPF a,ldw_v1.vbrk b, ldw_v1.bseg c
    where a.AWTYP='VBRK' and a.BLART='RV' and a.BUKRS='8431' and a.awkey=b.vbeln
    and a.bukrs=c.bukrs and a.belnr=c.belnr and a.gjahr=c.gjahr and c.koart='D'
    and c.ktosl is null and c.gsber='4466' and a.gjahr>='2011' and b.vtweg='01'
    ,t2 as(
    select a.BUKRS,a.BELNR, a.GJAHR,t1.vtweg,t1.budat,t1.monat from t1, ldw_v1.bkpf a
    where t1.zuonr=a.xblnr and a.blart='WL' and bukrs='8431'
    ,tcogs as (
    select t2.budat,t2.monat,t2.vtweg, bseg.gjahr,bseg.hkont,bseg.prctr,
    sum(bseg.wrbtr) as COGS,bseg.matnr,bseg.kunnr,sum(bseg.menge) as QUANTITY
    from t2, ldw_v1.bseg
    where t2.bukrs=bseg.bukrs and t2.belnr=bseg.BELNR and t2.gjahr=bseg.gjahr and BSEG.KOART='S'
    group by t2.budat,t2.monat,t2.vtweg, bseg.gjahr,bseg.hkont,bseg.prctr,
    bseg.matnr,bseg.kunnr
    ,t3 as
    select a.budat,a.monat,b.vtweg,
    c.gjahr,c.buzei,c.shkzg,c.hkont, c.prctr,
    case when c.shkzg='S' then c.wrbtr*(-1)
    else c.wrbtr end as NTS,
    c.matnr,c.kunnr,
    c.menge*(-1) as Quantity
    from ldw_v1.BKPF a,ldw_v1.vbrk b, ldw_v1.bseg c
    where a.AWTYP='VBRK' and a.BLART='RV' and a.BUKRS='8431' and a.awkey=b.vbeln
    and a.bukrs=c.bukrs and a.belnr=c.belnr and a.gjahr=c.gjahr and c.koart='S'
    and c.ktosl is null and c.gsber='4466' and a.gjahr>='2011' and b.vtweg='01'
    ,trevenue as (
    select t3.budat,t3.monat,t3.vtweg, t3.gjahr,t3.hkont,t3.prctr,
    sum(t3.NTS) as NTS,t3.matnr,t3.kunnr,sum(t3.QUANTITY) as QUANTITY
    from t3
    group by t3.budat,t3.monat,t3.vtweg, t3.gjahr,t3.hkont,t3.prctr,t3.matnr,t3.kunnr
    select NVL(tr.budat,tc.budat) as budat,
    NVL(tr.monat,tc.monat) as monat,
    NVL(tr.vtweg,tc.vtweg) as vtweg,
    NVL(tr.gjahr, tc.gjahr) as gjahr,
    tr.hkont as NTS_hkont,
    tc.hkont as COGS_hkont,
    NVL(tr.prctr,tc.prctr) as prctr,
    NVL(tr.MATNR, tc.MATNR) as matnr,
    NVL(tr.kunnr, tc.kunnr) as kunnr,
    NVL(tr.Quantity, tc.Quantity) as Quantity,
    tr.NTS as NTS,
    tc.COGS as COGS
    from trevenue TR full outer join tcogs TC
    on TR.BUDAT=TC.BUDAT and TR.MONAT=TC.MONAT and TR.GJAHR=TC.GJAHR
    and TR.MATNR=TC.MATNR and TR.KUNNR=TC.KUNNR and TR.QUANTITY=TC.QUANTITY
    and TR.VTWEG=TC.VTWEG and TR.PRCTR=TC.PRCTR
    Edited by: user13566113 on 25.03.2011 5:26

    Without seeing what you tried it is hard to say what you did wrong, but this is how it would work
    SQL> create table t ( n number );
    Table created.
    SQL> insert into t
      2  with test_data as
      3    (select 1 x from dual union all
      4     select 2 x from dual union all
      5     select 3 x from dual union all
      6     select 4 x from dual)
      7  select x from test_data;
    4 rows created.
    SQL>

Maybe you are looking for

  • It's Time To Talk #RetroThinkPad Design!

    David Hill published his follow-up Retro ThinkPad article on the Lenovo Blog this morning! Read the article: http://blog.lenovo.com/en/blog/retro-thinkpad-survey-keyboard/ The response to the first article far exceeded anyone's expectations, and now

  • How remove space in column ?

    In a.newunit column I have spaces before data. I tried to use TRIM and LTRIM -- but doesn't work :( What else I can use? SELECT LTRIM(u.scode), LTRIM(a.newunit) FROM unit u, aaa_test a WHERE LTRIM(u.scode) = LTRIM(a.newunit)

  • Problem in Login to Enterprise Manager Cosole

    I have installed ORACLE 9i Rel:9.0.1.0.1, after configuring the Mangement Server when I am trying to load Enterprise Manager Console program and when I enter username and password, I got an error says "Incorrect Login Credentials". If anybody can hel

  • Fireworks CS4 Internal error when starting

    Hello, Have upgraded to CS4 Web Premium yesterday. Everything seems to working fine except for Fireworks. When trying to load it says 'Fireworks can not be started, internal error occurred' . This always happens on the splash screen at the point 'Ini

  • Why does my iphone 4 keep rebooting itself uncontrollably

    i left my iphone 4 in my car in sub zero temperatures for a few hours while skiing and when i came back it started acting all weird and refused to turn on. so thinking it was just cold and needed some time to reheat itself, i wernt home and plugged i