Need to join two queries A/R statemet and Activity report

I have two  separate queries that need to be one. I have an A/R statement where I want to add notes next to each invoice. Currently these are two separate reports. How can I link the activity Report to the A/R Statement. Below are the two separate reports. I am not sure how to join the files. A/R Aging Report Declare @d datetime set @d /*Select 1 from jdt1 t where t.duedate*/=[%1] select * from ( SELECT T1.CardCode, T1.CardName, T0.RefDate, T0.Ref1 'Document Number',     CASE  WHEN T0.TransType=13 THEN 'Invoice'           WHEN T0.TransType=14 THEN 'Credit Note'           WHEN T0.TransType=30 THEN 'Journal'           WHEN T0.TransType=24 THEN 'Receipt'           END AS 'Document Type',     T0.DueDate, (T0.Debit- T0.Credit) 'Balance'     ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,@d)=0 and DateDiff(day, T0.DueDate,@d)30 and DateDiff(day, T0.DueDate,@d)60 and DateDiff(day, T0.DueDate,@d)90 and DateDiff(day, T0.DueDate,@d)=121),0) '121+ Days' FROM JDT1 T0 INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode WHERE  T1.CardType = 'C' ) sub Activity Report SELECT T1.[ClgCode],T2.[U_NAME], T4.[Name] as Status, T0.[CardCode], T0.[CardName], T0.[DocNum], T0.[U_AIS_DVIInvName] as 'SF Invoice Name', (T0.U_AIS_DVISFSO) as 'SO#', T0.[DocDate],T0.Taxdate as 'Month Of Service',T0.[U_AIS_DVIOpptyNm],T0.[U_AIS_DVIAdvNm],T0.[U_AIS_DVIManNm],T0.[U_AIS_DVIAcctNm], T0.[DocTotal], T0.[DocStatus],  T1.[Recontact],  T1.[Details], T1.[Notes], T1.[CntctType], T3.[Name] FROM OINV T0 left join OCLG T1 on t0.docentry = t1.docentry and  T0.[ObjType]  =  T1.[DocType] left outer JOIN OUSR T2 ON T1.UserSign = T2.USERID left outer join OCLT T3 ON T1.CntctType = T3.Code left outer join OCLS T4 ON  T1.CntctSbjct = T4.Code where T1.[CntctType] =6 or T1.[CntctType] =7

This is what I have so far.. it finally produced results but I notice the amount on the Activity + Aging does not match what is on the Aging and that seems to be what the issue is... that was my check to know the report is working. Basically the report should show the aging + any activity associated with the open invoice. The amount on the report is lower than the aging.. I am attaching the aging query  and the aging with activity Query. It looks like something is not joining correctly as the amounts do not match on the balance. Aging Report Declare @d datetime set @d /*Select 1 from jdt1 t where t.duedate*/=[%1] select * from ( SELECT T1.CardCode, T1.CardName, T0.RefDate, T0.Ref1 'Document Number',     CASE  WHEN T0.TransType=13 THEN 'Invoice'           WHEN T0.TransType=14 THEN 'Credit Note'           WHEN T0.TransType=30 THEN 'Journal'           WHEN T0.TransType=24 THEN 'Receipt'           END AS 'Document Type',     T0.DueDate, (T0.Debit- T0.Credit) 'Balance'     ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,@d)=0 and DateDiff(day, T0.DueDate,@d)30 and DateDiff(day, T0.DueDate,@d)60 and DateDiff(day, T0.DueDate,@d)90 and DateDiff(day, T0.DueDate,@d)=121),0) '121+ Days' FROM JDT1 T0 INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode WHERE  T1.CardType = 'C' ) sub Activity + Aging Declare @d datetime set @d /*Select 1 from jdt1 t where t.duedate*/=[%1] select * from ( SELECT T1.CardCode, T1.CardName, T0.RefDate, T0.Ref1 'Document Number',     CASE  WHEN T0.TransType=13 THEN 'Invoice'           WHEN T0.TransType=14 THEN 'Credit Note'           WHEN T0.TransType=30 THEN 'Journal'           WHEN T0.TransType=24 THEN 'Receipt'           END AS 'Document Type',     T0.DueDate, (T0.Debit- T0.Credit) 'Balance'     ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,@d)=0 and DateDiff(day, T0.DueDate,@d)30 and DateDiff(day, T0.DueDate,@d)60 and DateDiff(day, T0.DueDate,@d)90 and DateDiff(day, T0.DueDate,@d)=121),0) '121+ Days', T6.[FirstName] as 'AP Contact First Name', T6.[LastName] as 'AP Contact Last Name' , T6.[E_MailL], T6.[Notes1] as ' AP Supervisor', T2.[ClgCode],T7.[U_NAME], T4.[Name] as Status, T5.[DocNum], T5.[U_AIS_DVIInvName] as 'SF Invoice Name', (T5.U_AIS_DVISFSO) as 'SO#', T5.[DocDate],T5.Taxdate as 'Month Of Service',T5.[U_AIS_DVIOpptyNm],T5.[U_AIS_DVIAdvNm],T5.[U_AIS_DVIManNm],T5.[U_AIS_DVIAcctNm], T5.[DocTotal], T5.[DocStatus],  T2.[Recontact],  T2.[Details], T2.[Notes], T2.[CntctType], T3.[Name] FROM JDT1 T0 INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode INNER JOIN OCLG T2 ON T1.CardCode = T2.CardCode INNER JOIN OCLT T3 ON T2.CntctType = T3.Code INNER JOIN OCLS T4 ON T2.CntctSbjct = T4.Code INNER JOIN OINV T5 ON t5.docentry = t2.docentry and  T5.[ObjType]  =  T2.[DocType] left outer join OCPR T6 ON T2.CntctCode = T6.CntctCode left outer JOIN OUSR T7 ON T2.UserSign = T7.USERID WHERE  T1.CardType = 'C' and (T2.[CntctType] =6 or T2.[CntctType] =7) ) sub

Similar Messages

  • Report Designer - place two queries side by side in a report.

    I have a need to place two queries side by side in a report, I get a message that it is not possible to insert all fields.  What I am doing is placing each query in a report section and then trying to move the fields from one section to the previous section.  I am not sure if I am doing this correct.  Can someone let me know if this is possible and if so what am I doing incorrectly?  Thank you for your time and assistance!

    Hi Margaret,
    It is possible to display two queries side by side in a report.
    You just need to adjust the layout by dragging the each query along side each other - as you want to see it in the output.
    There is no need to move individual fields.
    Hope this helps!
    Regards,
    Saurabh

  • Join two queries

    I'm tryinng to join two queries that I made in sqlplus:
    the first one is:
    select dname,sum(hours) as proj_hrs
    from IBL.works_on w ,IBL.project p,IBL.department d
    where w.pno=p.pnumber
    and p.dnum=d.dnumber
    group by dname;
    that output:
    DNAME PROJ_HRS
    Administration 115
    Headquarters 25
    Research 155
    the second one is:
    select dname,sum(hours) as emp_hrs
    from IBL.works_on w,IBL.employee e,IBL.department d
    where e.dno=d.dnumber
    and w.essn=e.ssn
    group by dname;
    that output
    DNAME EMP_HRS
    Administration 115
    Headquarters
    Research 180
    I'm trying to join both of them to get:
    DNAME PROJ_HRS EMP_HRS
    Administration 115 115
    Headquarters 25
    Research 155 180
    Can anybody help me please

    If I understood you correctly, have you tried this? I did not try this, just think that it will work.
    select a.dname, a.proj_hrs, b.emp_hrs from
    select dname,sum(hours) as proj_hrs
    from IBL.works_on w ,IBL.project p,IBL.department d
    where w.pno=p.pnumber
    and p.dnum=d.dnumber
    group by dname
    ) a,
    select dname,sum(hours) as emp_hrs
    from IBL.works_on w,IBL.employee e,IBL.department d
    where e.dno=d.dnumber
    and w.essn=e.ssn
    group by dname
    ) b
    where a.dname = b.dname
    You can use the NVL function to print out something special for the null values.

  • Joining two queries with Visual Composer

    Hallo,
    I was working with visual composer to join two queries with the distinct operator. But on my table view, when i linked it with the distinct operator, i get only the key element customer (customer, customer_ext_key, customer_key). These are the queries that i want join:
    Query 1:
    Customer
    Net Sales
    Query 2:
    Customer
    Billed Quantity
    What i want to see is the following result:
    Customer
    Net Sales
    Billed Quantity
    Can anybody help me with this problem?
    Greeting,
    Murat.

    Hallo,
    I was working with visual composer to join two queries with the distinct operator. But on my table view, when i linked it with the distinct operator, i get only the key element customer (customer, customer_ext_key, customer_key). These are the queries that i want join:
    Query 1:
    Customer
    Net Sales
    Query 2:
    Customer
    Billed Quantity
    What i want to see is the following result:
    Customer
    Net Sales
    Billed Quantity
    Can anybody help me with this problem?
    Greeting,
    Murat.

  • How to join two queries

    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    _1st query_
    select
    (CASE WHEN SUBSTR(R1.RA_NO,1,3)= 'NRA' THEN 'Damansara Uptown One Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,3)= 'ORA' THEN 'Damansara Uptown Two Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,3)= 'VRA' THEN 'Damansara Uptown Realty Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,3)= 'URA' THEN 'Uptown Elite Sdn. Bhd.'
    when SUBSTR(R1.RA_NO,1,3)= 'WRZ' THEN 'U5 Management Corporation Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,2)= 'FR' THEN 'See Hoy Chan Facilities Management Sdn.Bhd.' END) Landlord
    ,TO_CHAR(C1.COLL_DTE,'RRRRMM') MONTH1
    ,SUM(C2.TRN_AMT) UPTO_31
    , SUM(CASE WHEN to_char(C1.COLL_dte) BETWEEN to_date(:P_FROM_DATE,'dd.mm.yyyy') AND '16-'||to_date(:P_TO_DATE,'dd.mm.yyyy') THEN C2.TRN_AMT END) UPTO_15
    from ra1 R1, COLLECT1 C1 , COLLECT2 C2
    where
    (to_char(C1.COLL_dte) between to_date(:P_FROM_DATE,'dd.mm.yyyy') AND to_date(:P_TO_DATE,'dd.mm.yyyy'))
    and (SUBSTR(R1.RA_NO,1,2)= 'FR' or SUBSTR(R1.RA_NO,1,3) in ('NRA' ,'ORA','VRA','URA','WRZ'))
    AND R1.RA_NO = C2.INV_NO
    AND C2.COLL_NO = C1.COLL_NO
    GROUP BY
    (CASE WHEN SUBSTR(R1.RA_NO,1,3)= 'NRA' THEN 'Damansara Uptown One Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,3)= 'ORA' THEN 'Damansara Uptown Two Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,3)= 'VRA' THEN 'Damansara Uptown Realty Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,3)= 'URA' THEN 'Uptown Elite Sdn. Bhd.'
    when SUBSTR(R1.RA_NO,1,3)= 'WRZ' THEN 'U5 Management Corporation Sdn. Bhd.'
    WHEN SUBSTR(R1.RA_NO,1,2)= 'FR' THEN 'See Hoy Chan Facilities Management Sdn.Bhd.' END)
    ,TO_CHAR(C1.COLL_DTE,'RRRRMM')
    _2query_
    select sum(decode(substr(ra_no,1,7),'NRA'
    ||to_char(to_date(:P_FROM_DATE,'dd.mm.yyyy'),'yymm'),tot_amt,0)) NRA
    ,sum(decode(substr(ra_no,1,7),'VRA'
    ||to_char(to_date(:P_FROM_DATE,'dd.mm.yyyy'),'yymm'),tot_amt,0)) VRA
    ,sum(decode(substr(ra_no,1,7),'ORA'
    ||to_char(to_date(:P_FROM_DATE,'dd.mm.yyyy'),'yymm'),tot_amt,0)) ORA
    ,sum(decode(substr(ra_no,1,7),'FR'
    ||to_char(to_date(:P_FROM_DATE,'dd.mm.yyyy'),'yymm'),tot_amt,0)) FR
    ,sum(decode(substr(ra_no,1,7),'WRZ'
    ||to_char(to_date(:P_FROM_DATE,'dd.mm.yyyy'),'yymm'),tot_amt,0)) WRZ
    ,sum(decode(substr(ra_no,1,7),'URA'
    ||to_char(to_date(:P_FROM_DATE,'dd.mm.yyyy'),'yymm'),tot_amt,0)) URA
    from RA1
    above are the two queries i need to join these two queries by naming the second query column name as total .

    1st query output  is ----------
    LOCATION                                                                 MONTH1    UPTO_31           UPTO_15        
    U5 Management Corporation Sdn. Bhd.                           201001     15250                8900                                 
    Uptown Elite Sdn. Bhd.                                                201001      3000                 1500                                 
    See Hoy Chan Facilities Management Sdn.Bhd.                 201001      917115.45         584876.5                            
    Damansara Uptown Two Sdn. Bhd.                                201001      757277.45         495362.95                          
    Damansara Uptown One Sdn. Bhd.                                 201001     881558.65          404872.45                          
    Damansara Uptown Realty Sdn. Bhd.                              201001      321675.8           150508.6                              
    2nd query output is -------
    NRA              ORA              VRA              URA              WRZ           FR
    2323.31        95945           34367.8        34267            4343         343
    Now what i need is
    LOCATION                                                                 MONTH1    UPTO_31           UPTO_15          TOTAL
    U5 Management Corporation Sdn. Bhd.                           201001     15250                8900                2323.31                 
    Uptown Elite Sdn. Bhd.                                                201001      3000                 1500                95945                  
    See Hoy Chan Facilities Management Sdn.Bhd.                 201001      917115.45         584876.5           34367.8                  
    Damansara Uptown Two Sdn. Bhd.                                201001      757277.45         495362.95          34267                 
    Damansara Uptown One Sdn. Bhd.                                 201001     881558.65          404872.45           4343
    Damansara Uptown Realty Sdn. Bhd.                              201001      321675.8           150508.6           343above is the clear picture what i need , i don't know how to do it please help me
    Edited by: user9093689 on Feb 21, 2010 8:06 PM

  • Joining two queries causes big performance hit

    There are two queries: one with a sub query and one without
    although they both return the same data, one uses a full table scan of the indexed 'trade_index' table
    and thus is much slower
    any Ideas why it does this?:
    SQL> select count(*) from trade_index ti, counterparty_xref cx
    2 where ti.CPY_SID = cx.CPY_SID and ti.TRADE_OR_ARCHIVE = 'A'
    3 and cx.XREF_VALUE in (select ml.VALUE from v_mis_lists ml where ml.LIST_NAME = 'Deutsche Bank DB')
    4 and cx.XREF_TYPE = 'Client RXM'
    5 and ti.START_DATE < to_date('01/01/2004','DD/MM/YYYY')
    6 and (ti.END_DATE >= to_date('01/01/2003','DD/MM/YYYY') or ti.END_DATE = '01-Jan-1900') ;
    COUNT(*)
    6195
    Elapsed: 00:00:15.08
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2572 Card=1 Bytes=57)
    1 0 SORT (AGGREGATE)
    2 1 HASH JOIN (Cost=2572 Card=26581 Bytes=1515117)
    3 2 HASH JOIN (Cost=460 Card=5619 Bytes=219141)
    4 3 VIEW OF 'VW_NSO_1' (Cost=8 Card=16 Bytes=272)
    5 4 SORT (UNIQUE) (Cost=8 Card=16 Bytes=960)
    6 5 HASH JOIN (Cost=4 Card=16 Bytes=960)
    7 6 TABLE ACCESS (BY INDEX ROWID) OF 'MIS_LISTS' (Cost=1 Card=2 Bytes=60)
    8 7 INDEX (RANGE SCAN) OF 'MISL_NAT_UK' (UNIQUE) (Cost=2 Card=2)
    9 6 TABLE ACCESS (FULL) OF 'MIS_LIST_VALUES' (Cost=2 Card=817 Bytes=24510)
    10 3 TABLE ACCESS (FULL) OF 'COUNTERPARTY_XREF' (Cost=451 Card=35116 Bytes=772552)
    11 2 TABLE ACCESS (FULL) OF 'TRADE_INDEX' (Cost=2056 Card=286928 Bytes=5164704)
    SQL> select ml.VALUE from v_mis_lists ml where ml.LIST_NAME = 'Deutsche Bank DB';
    VALUE
    B49540
    B60010
    Elapsed: 00:00:00.00
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE
    1 0 NESTED LOOPS
    2 1 TABLE ACCESS (BY INDEX ROWID) OF 'MIS_LISTS'
    3 2 INDEX (RANGE SCAN) OF 'MISL_NAT_UK' (UNIQUE)
    4 1 INDEX (RANGE SCAN) OF 'MISLV_PK' (UNIQUE)
    SQL> select count(*) from trade_index ti, counterparty_xref cx
    2 where ti.CPY_SID = cx.CPY_SID and ti.TRADE_OR_ARCHIVE = 'A'
    3 and cx.XREF_VALUE in ('B49540','B60010')
    4 and cx.XREF_TYPE = 'Client RXM'
    5 and ti.START_DATE < to_date('01/01/2004','DD/MM/YYYY')
    6 and (ti.END_DATE >= to_date('01/01/2003','DD/MM/YYYY') or ti.END_DATE = '01-Jan-1900') ;
    COUNT(*)
    6195
    Elapsed: 00:00:02.06
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=532 Card=1 Bytes=40)
    1 0 SORT (AGGREGATE)
    2 1 NESTED LOOPS (Cost=532 Card=41 Bytes=1640)
    3 2 TABLE ACCESS (FULL) OF 'COUNTERPARTY_XREF' (Cost=451 Card=1 Bytes=22)
    4 2 TABLE ACCESS (BY INDEX ROWID) OF 'TRADE_INDEX' (Cost=81 Card=286928 Bytes=5164704)
    5 4 INDEX (RANGE SCAN) OF 'CPY_SID_IDX' (NON-UNIQUE) (Cost=2 Card=286928)
    What I dont understand is that:
    cx.XREF_VALUE in (select ml.VALUE from v_mis_lists ml where ml.LIST_NAME = 'Deutsche Bank DB')
    and
    cx.XREF_VALUE in ('B49540','B60010')
    are essentially the same thing
    (ie the subquery returns the values I have used)
    but the optimizer uses a totally different (slower) method to execute the rest of the former query?
    Many thanks
    Ian

    Hi,
    Here is with join and not using the view: still have full table scan of large table trade_index
    SQL> select count(*) from mis_lists ml, mis_list_values mlv, counterparty_xref cx, trade_index ti
    2 where ti.CPY_SID = cx.CPY_SID and ti.TRADE_OR_ARCHIVE = 'A'
    3 and cx.XREF_VALUE = mlv.VALUE
    4 and mlv.MISL_SID = ml.MISL_SID
    5 and ml.LIST_NAME = 'Deutsche Bank DB'
    6 and cx.XREF_TYPE = 'Client RXM'
    7 and ti.START_DATE < to_date('01/01/2004','DD/MM/YYYY')
    8 and (ti.END_DATE >= to_date('01/01/2003','DD/MM/YYYY') or ti.END_DATE = '01-Jan-1900') ;
    COUNT(*)
    6195
    Elapsed: 00:00:12.08
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2602 Card=1 Bytes=10
    0)
    1 0 SORT (AGGREGATE)
    2 1 HASH JOIN (Cost=2602 Card=26581 Bytes=2658100)
    3 2 HASH JOIN (Cost=456 Card=5619 Bytes=460758)
    4 3 HASH JOIN (Cost=4 Card=16 Bytes=960)
    5 4 TABLE ACCESS (BY INDEX ROWID) OF 'MIS_LISTS' (Cost1 Card=2 Bytes=60)
    6 5 INDEX (RANGE SCAN) OF 'MISL_NAT_UK' (UNIQUE) (Cost=2 Card=2)
    7 4 TABLE ACCESS (FULL) OF 'MIS_LIST_VALUES' (Cost=2 Card=817 Bytes=24510)
    8 3 TABLE ACCESS (FULL) OF 'COUNTERPARTY_XREF' (Cost=451Card=35116 Bytes=772552)
    9 2 TABLE ACCESS (FULL) OF 'TRADE_INDEX' (Cost=2056 Card=286928 Bytes=5164704)
    Statistics
    0 recursive calls
    47 db block gets
    16519 consistent gets
    4981 physical reads
    0 redo size
    205 bytes sent via SQL*Net to client
    622 bytes received via SQL*Net from client
    3 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed
    Thanks for you help,
    Ian

  • Help with joining two queries

    Hi
    We recently inherited a database and we are re-wrting some queries. The first is
    SELECT gu.GEOGRAPHIC_UNIT_ID, gu.GEOGRAPHIC_UNIT_DESC, aggDataC.DATA as Capacity, aggDataP.DATA as Production
    FROM GEOGRAPHIC_UNIT_RELATIONSHIP gur, GEOGRAPHIC_UNIT
    gu, AGGREGATED_DATA aggDataC, AGGREGATED_DATA aggDataP
    WHERE      gur.PARENT_GEOGRAPHIC_UNIT_ID = :geographicUnitId AND gur.CHILD_GEOGRAPHIC_UNIT_ID = gu.GEOGRAPHIC_UNIT_ID
    AND aggDataC.GEOGRAPHIC_UNIT_ID = gu.GEOGRAPHIC_UNIT_ID
    AND ((:CommodityGroupId IS NULL AND
    aggDataC.COMMODITY_GROUP_ID IS NULL) OR (:CommodityGroupId = aggDataC.COMMODITY_GROUP_ID))
    AND ((:CommodityTypeId IS NULL AND
    aggDataC.COMMODITY_TYPE_ID IS NULL) OR (:CommodityTypeId = aggDataC.COMMODITY_TYPE_ID))
    AND ((:PlantTypeId IS NULL AND aggDataC.PLANT_TYPE_ID
    IS NULL) OR (:PlantTypeId = aggDataC.PLANT_TYPE_ID))
    AND aggDataC.ORGANISATION_ID is NULL
    AND aggDataC.YEAR = :Year
    AND aggDataC.STAT_TYPE_ID = (SELECT stat_type_id FROM
    stat_type WHERE stat_type = 'CAP')
    AND aggDataC.STAT_PERIOD_TYPE_ID = :StatPeriodTypeId
    AND aggDataP.GEOGRAPHIC_UNIT_ID = gu.GEOGRAPHIC_UNIT_ID
    AND ((:CommodityGroupId IS NULL AND
    aggDataP.COMMODITY_GROUP_ID IS NULL) OR (:CommodityGroupId = aggDataP.COMMODITY_GROUP_ID))
    AND ((:CommodityTypeId IS NULL AND
    aggDataP.COMMODITY_TYPE_ID IS NULL) OR (:CommodityTypeId = aggDataP.COMMODITY_TYPE_ID))
    AND ((:PlantTypeId IS NULL AND aggDataP.PLANT_TYPE_ID
    IS NULL) OR (:PlantTypeId = aggDataP.PLANT_TYPE_ID))
    AND aggDataP.ORGANISATION_ID is NULL
    AND aggDataP.YEAR = :Year
    AND aggDataP.STAT_TYPE_ID = (SELECT stat_type_id FROM
    stat_type WHERE stat_type = 'PRD')
    The above query returns only the geographic units that have capacity and production figures.
    I want to return all other regions that have a plantypeid regardless of whether they have capacity and production data.
    I tried to use outer joins but this has not worked. The database is an oracledatabase
    the below query returns all the geographic regions I need
    SELECT gu.GEOGRAPHIC_UNIT_ID, gu.GEOGRAPHIC_UNIT_DESC
    FROM GEOGRAPHIC_UNIT_RELATIONSHIP gur, GEOGRAPHIC_UNIT gu
    where
    gur.PARENT_GEOGRAPHIC_UNIT_ID = :geographicUnitId
    AND gur.CHILD_GEOGRAPHIC_UNIT_ID = gu.GEOGRAPHIC_UNIT_ID
    ANy idea how I merge the 2 queries?

    UNION

  • Joining two queries

    hi every one...
    i have to prepare report in the following way
    srno asset_code asset_group asset_cost
    here asset code and asset group i have to pick from flex field valueset...fr this the query is
    SELECT FLEX_VALUE asset_code, DESCRIPTION asset_group
    FROM FND_FLEX_VALUES_VL ffvh
    WHERE ffvh.flex_value_set_id =
    (select FLEX_VALUE_SET_ID from fnd_flex_value_sets
    where FLEX_VALUE_SET_NAME = 'XXEAM_ACCOUNT_CODE_KFF')
    AND ENABLED_FLAG = 'Y'
    AND SUMMARY_FLAG = 'Y'
    here the each asset_code has their child values and asset cost to that child value..
    so i have to calculate that total asset cost for total child values of each parent(asset_code)...
    for this the query is
    SELECT sum(asset_cost) asset_cost
    FROM csi_item_instances cii,
    xxeam_depreciation_master xdm
    WHERE cii.serial_number = xdm.serial_number
    AND cii.attribute3 IN (
    SELECT ffvh.flex_value
    FROM fnd_flex_values_vl ffvh
    WHERE ffvh.flex_value_set_id =
    (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name =
    'XXEAM_ACCOUNT_CODE_KFF')
    AND enabled_flag = 'Y'
    AND summary_flag = 'N'
    AND ffvh.flex_value IN (
    SELECT child_flex_value_low
    FROM fnd_flex_value_norm_hierarchy ffvnh
    WHERE ffvnh.range_attribute = 'C'
    AND ffvnh.flex_value_set_id =
    ffvh.flex_value_set_id
    AND ffvnh.parent_flex_value ='10.100'))
    here instead of mentioning ffvnh.parent_flex_value ='10.100'
    i have to find for all parent values..
    so im not able to find this and im not able to make joins..
    so any one plz help me...
    thanks in advance..

    More or less a stab in the dark, but it sounds like you should cross join the groups and date tables with each other:
    SELECT DATEADD(MONTH,- 1, A.Date_Date)AS Report_Date, GROUP_NAME
                 SELECT COUNT(B.Ticket_ID)AS Active_Ticket_Count
                 FROM [HPSM].[dbo].[HPSM_Assignments] B
                 WHERE   B.Assignment_Scope= 'Group'
                    AND  B.Assigned_Timestamp< A.Date_Date
                    AND  B.Resolved_Timestamp> A.Date_Date   
                    AND  B.Group_Name= G.Assigned_To
          ) AS Active_Count
     FROM [ITSReporting ].[dbo].[REF_Date]A      
     CROSS JOIN [HPSM].[dbo].[HPSM_Groups] G
     WHERE Date_Is_Month_Start= 1
          AND A.Date_Date>= dateadd(ms,- 3,dateadd(mm,- 12,dateadd(mm,datediff(mm,0,getdate()),0)))
          AND A.Date_Date< dateadd(ms,- 3,dateadd(mm,1,dateadd(mm,datediff(mm,0,getdate()),0)))
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Where clause in COUNT function and joining two queries

    I have a table that I am trying to count the number of course passed, and also list the modules passed as well.
    the first problem I am having is what to put in the where variable , so that its not specific to a customer(I can use the query below for a particular customer and a particular course)but I will like a generic query where the result will be distinct in terms
    of user and course like the one below
    select FirstName,LastName,CourseTitle,Noofmodules, count (Coursecompleted) as modulescompleted from EStudentsprogress where Coursecompleted = '1'and EmailAddress = '[email protected]'
    and CourseTitle = 'Microsoft MOS 2010 EXCEL' Group by FirstName, LastName, CourseTitle, Noofmodules ;
    How can i make it list the result as above, whereby i dont specify the email address or course title(trying to get the result for all the clients )
    . Also I have a query that list the courses that is passed by the customer, I will like the column with the list of courses passed be added to the result above, but as a column for each course.
    select FirstName,LastName,CourseTitle, EmailAddress, CourseModule as coursepassed from EStudentsprogress where coursecompleted =1
    cheers

    Do you mean this?
    select FirstName,
    LastName,
    CourseTitle,
    Noofmodules,
    count (Coursecompleted) as modulescompleted,
    STUFF((SELECT ',' + CourseTitle
    FROM EStudentsprogress
    WHERE FirstName = e.FirstName
    AND LastName = e.LastName
    WHERE Coursecompleted = '1'
    FOR XML PATH('')),1,1,'') AS CoursesCompleted
    from EStudentsprogress e
    where Coursecompleted = '1'
    Group by FirstName, LastName, CourseTitle, Noofmodules ;
    If not please provide some sample data and explain the output you want
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page
    I AM HAVING Incorrect syntax near the keyword 'WHERE'. 
    It was a typo
    try this
    select FirstName,
    LastName,
    CourseTitle,
    Noofmodules,
    count (Coursecompleted) as modulescompleted,
    STUFF((SELECT ',' + CourseTitle
    FROM EStudentsprogress
    WHERE FirstName = e.FirstName
    AND LastName = e.LastName
    AND Coursecompleted = '1'
    FOR XML PATH('')),1,1,'') AS CoursesCompleted
    from EStudentsprogress e
    where Coursecompleted = '1'
    Group by FirstName, LastName, CourseTitle, Noofmodules ;
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page
    its populating all the result for a particular customer, so i added another clause to  it and it worked
    select FirstName,
    LastName,
    CourseTitle,
    Noofmodules, 
    count (Coursecompleted) as modulescompleted,
    STUFF((SELECT ','  + CourseTitle
    FROM EStudentsprogress 
    WHERE FirstName = e.FirstName
    AND LastName = e.LastName
    AND Coursecompleted = '1'
    AND CourseTitle = e.CourseTitle
    FOR XML PATH('')),1,1,'') AS CoursesCompleted
    from EStudentsprogress e
    where Coursecompleted = '1'
    Group by FirstName, LastName, CourseTitle, Noofmodules ;
    but the result of the column is long , so i tried to used the course module, which is a column with numbers, and i tried modifying the query , but i had Error converting data type varchar to float.( i checked and saw that stuff is for concatinating
    strings) is there a way around it.
    i used 
    select FirstName,
    LastName,
    CourseModule,
    CourseTitle,
    Noofmodules, 
    count (Coursecompleted) as modulescompleted,
    STUFF((SELECT ','  + CourseModule
    FROM EStudentsprogress 
    WHERE FirstName = e.FirstName
    AND LastName = e.LastName
    AND Coursecompleted = '1'
    AND CourseTitle = e.CourseTitle
    FOR XML PATH('')),1,1,'') AS CoursesCompleted
    from EStudentsprogress e
    where Coursecompleted = '1'
    Group by FirstName, LastName,CourseModule, CourseTitle, Noofmodules ;

  • Do we need to create two different home for UCM and WC?

    Hi All,
    I am trying to create Webcenter VM(oracle linux 5) with ECM I used 11.1.1.5.0 version for all installable.for creating this VM.
    here do we need to create separate Home for webcenter and UCM installations.
    any one give me some proper directions to installation of the same
    thank you!
    Siva

    yes i saw those folders but while installing I installed weblogic server in fmw folder.then Installed UCM on top of the i installed WC,but while installing WC its showing ora home is already exits select another or override. like that i am getting so i override. when i am creating domain its completed but i am not able to see startWeblogic.sh in bin folder of the domain.
    I realized that i did mistake while installation.
    can you please give me best infrastructure for web-center installation with all features(portal,sites spaces and content) I have sufficient memory to run multiple VMs.
    Thank you!
    Siva

  • How to join these two queries

    Hi experts,
    I need to join two queries but not sure how:
    select id from test_table1;
    select *
      from table(f_function(null
                           ,null
                           ,1 -- the id
                           ,sysdate);One query has IDs needed to run the second query. Is there a way to join those two?
    The result should be all columns from test_table1 + all columns from f_function.
    Best regards,
    Igor
    Edited by: Igor S. on Mar 8, 2013 5:18 AM

    Hi,
    Igor S. wrote:
    select  *
    from  test_table1,
    table(
    f_function(
    null,
    null,
    id,
    sysdate
    select  *
    from  test_table1,
    table(
    f_function(
    null,
    null,
    id,
    sysdate
    ) xyz
    where test_table1.id = xyz.id
    /So these two queries are the same?Try it and see.
    You'll find that the 2nd one produces an error. But if you change it to
    select  *
      from  test_table1,
            table(
                  f_function(
                             null,
                             null,
                             id,
                             sysdate
                            )      -- No alias here
                 ) xyz             -- Alias here, instead
    where test_table1.id = xyz.id
    /Then, assuming f_function produces a column called id, it will work.
    Whether it produces the same results or not depends on what the function returns, and whether either id is NULL.
    If the id column that the function returns is the same as the id value that you pass to it, and is never NULL, then the 2 queries will produce the same results.
    Either way, each row of test_table1 will be joined to each row that the function produces with the argument(s) from that row. The column names produced by the function and the values in those columns are determined by the function; they do not need to have anything in common with any table. In practice, a function like f_function will usually not return an column that is always identical to any of its inputs, since that value is already available from the input.

  • Return two queries with cfreturn

    Hello All,
    I know I've seen it done somewhere, but I can't seem to find
    the example. I need to return two queries like:
    <cfreturn getCurrentProjects and
    getProjectRequestByStatus/>
    Something like that... not getting the right syntax or
    something. Any clues?
    Thanks!

    You can't!!!! You can only return one value with
    <cfreturn...>
    But of course there is nothing preventing that one value to
    be a
    structure or array contain two query record sets.
    I.E.
    <cfset var myReturn = strunctNew()>
    <cfset myReturn.getCurrentProjects =
    getCurrentProjects>
    <!--- getCurrentProjects is scoped as a local variable
    with VAR,
    correct? --->
    <cfset myReturn.getProjectRequestByStatus =
    getProjectRequestByStatus>
    <!--- getProjectRequest is scoped as a local variable with
    Var, correct?--->
    <cfreturn myReturn>

  • How can I join to queries?

    Hello all,
    I would like to ask if there is a way to join two queries into another new one.
    I've been trying including two structures from two queries (always from the same infoprovider) but the result is not what I'm looking for.
    Has anyone any idea of how to do this?
    Thank you very much,
    Carlos Hinestrosa

    Hi Michael,
    Thanks for your answer. I know there are lots of funtionalities in excel but I need the result of the query as simple as it is to work with it in SEM Balanced Scorecard / Management Cockpit because SEM does not support many BEX funtionalities.
    I make some calculations in one query and others in the other query, and I need the result of thoese calculations to make further calculations in a new query.
    I was trying to create a query but the dialog box only allows to create a query from a cube.
    Thanks,
    Carlos Hinestrosa

  • Join of queries

    Hello All
    Can someone tell me how to join two queries without using a multicube
    or infoprovider option.
    First Query has x, y, z fields
    Second Query has x,a,b fields
    now can i join the first and second query by the common field x.
    Without changing the infoprovider or multicube design,i want to join
    the query at the query level.
    I want to join the two queries using common field x and then replace
    the second query a, b fields with y, z fields data of query1.
    Regards

    Hi Santosh.
    If you want to use the workbook solution you should create one sheet for each query.
    Lets assume that you have X in column A in both sheets and Y and Z in column B and C in sheet1. For the columns D and E on sheet1 you should insert some VB-code that gets the data from sheet2 where X equals X from sheet1. Here is an example:
    =IF(ISNA(VLOOKUP(A1;sheet2!$A$1:$B$200;2;FALSE));"";(VLOOKUP(A1;sheet2!$A$1:$B$200;2;FALSE)))
    You will have to use this code for all the rows along the column. I.e. if A has an output of 200 rows, you will need the code from line 1->200. You will also have to consider that the results may be more in the future.
    Hope it helps.
    BR
    Stefan

  • Help Needed For joins

    Hi All,
    I am new to oracle.I have a requirement. i need to display sales fields for a particular time as below.
    Time    Sales
    6-7 3333
    7-8 45345
    8-9 546
    But the min time and max time are coming from different query and sales fields coming from different.Now i need to join both queries to get the results.But there is no common column.I tried with sub query there also i am getting error.Please find the queries and help me
    Hour Group Query:
    select
    time1.*,
    (select if (time_format(dt.curr_time, '%H') <
    time_format(ifnull((SELECT prop_value FROM cust_conv_properties c where prop_key = 'DayStartingTime'), '00:00:00'), '%H'),
    date_format(date_add(dt.curr_time, INTERVAL 0 DAY),'%d/%m/%Y'),
    date_format(dt.curr_time,'%d/%m/%Y')) as curr_date
    from
    (select concat(date_format(str_to_date('23/10/2011','%d/%m/%Y'),'%Y-%m-%d'), ' ', '00:00:00') as curr_time) dt) as report_date
    from
    (select
    -- 'S' temp,
    cast(min(cchg.from_hour) as unsigned) as min_value,
    cast(max(cchg.to_hour) as unsigned) as max_value,
    concat(concat(min(cchg.from_hour),''),'-',concat(max(cchg.to_hour),'')) as time_diff
    from
    cust_conv_hour_group as cchg
    where
    cchg.group_value in (SELECT distinct if(group_value = (SELECT min(group_value) FROM cust_conv_hour_group),
    (SELECT max(group_value) FROM cust_conv_hour_group), group_value-1) as group_value
    FROM cust_conv_hour_group c where from_hour <= cast(time_format('23:00:00','%H') as unsigned)
    and
    to_hour > cast(time_format('00:00:00','%H') as unsigned))
    group by
    cchg.group_value
    ) time1
    Sales Fields Query:
    SELECT
    if(count(cons.wr_tarSale)=0,0, cons.wr_tarSale) wr_tarSale,
    if(count(cons.wr_actSale)=0,0, cons.wr_actSale) wr_actSale,
    if(count(cons.wr_tarTrans)=0,0, cons.wr_tarTrans) wr_tarTrans,
    if(count(cons.wr_actTrans)=0,0, cons.wr_actTrans) wr_actTrans,
    if(count(cons.tarSale)=0,0, cons.tarSale) tarSale,
    if(count(cons.actSale)=0,0, cons.actSale) actSale,
    if(count(cons.varSale)=0,0, cons.varSale) varSale,
    if(count(cons.tarTrans)=0,0, cons.tarTrans) tarTrans,
    if(count(cons.actTrans)=0,0, cons.actTrans) actTrans,
    if(count(cons.actAds)=0,0, cons.actAds) actAds,
    if(count(cons.actUpt)=0,0, cons.actUpt) actUpt,
    if(count(cons.tarAds)=0,0, cons.tarAds) tarAds,
    if(count(cons.tarUpt)=0,0, cons.tarUpt) tarUpt,
    if(count(cons.actConv)=0,0, cons.actConv) actConv,
    if(count(cons.tarTplh)=0,0, cons.tarTplh) tarTplh,
    if(count(cons.actBlank1)=0,0, cons.actBlank1) actBlank1,
    if(count(cons.actBlank2)=0,0, cons.actBlank2) actBlank2,
    if(count(cons.actTplh)=0,0, cons.actTplh) actTplh,
    if(count(cons.sDTarSale)=0,0, cons.sDTarSale)sDTarSale,
    if(count(cons.sDTarTrans)=0,0, cons.sDTarTrans)sDTarTrans,
    if(count(cons.sDTarQty)=0,0, cons.sDTarQty)sDTarQty,
    if(count(cons.sDTarFF)=0,0, cons.sDTarFF)sDTarFF
    FROM
    SELECT
    ifnull(sum(ccsr.target_sale),0) wr_tarSale,
    ifnull(sum(ccsr.actual_sale),0) wr_actSale,
    ifnull(sum(ccsr.actual_transaction_count),0) wr_actTrans,
    ifnull(sum(ccsr.target_transaction_count),0) wr_tarTrans,
    round(ifnull(sum(ccsr.target_sale),0),2) tarSale,
    round(ifnull(sum(ccsr.actual_sale),0),2) actSale,
    round(round(ifnull(sum(ccsr.actual_sale),0),2)- round(ifnull(sum(ccsr.target_sale),0),2),2) varSale,
    round(ifnull(sum(ccsr.actual_transaction_count),0),0) actTrans,
    round(ifnull(sum(ccsr.target_transaction_count),0),0) tarTrans,
    0 actBlank1,
    round(ifnull((sum(ccsr.actual_sale)/sum(ccsr.actual_transaction_count)),0),2) actAds,
    round(ifnull((sum(ccsr.target_sale)/sum(ccsr.target_transaction_count)),0),2) tarAds,
    round(ifnull((sum(ccsr.actual_quantity)/sum(ccsr.actual_transaction_count)),0),2) actUpt,
    round(ifnull((sum(ccsr.target_quantity)/sum(ccsr.target_transaction_count)),0),2) tarUpt,
    round(ifnull((sum(ccsr.actual_transaction_count)/sum(ccsr.actual_footfalls))*100,0),2) actConv,
    0 actBlank2,
    0 actBlank3,
    round(ifnull((sum(ccsr.actual_footfalls)/sum(ccsr.actual_man_hours)),0),2) actTplh,
    round(ifnull((sum(ccsr.target_footfalls)/sum(ccsr.target_man_hours)),0),2) tarTplh,
    round(ifnull(ccsrs.target_sale,0),2) as sDTarSale,
    round(ifnull(ccsrs.target_transaction_count,0),0) as sDTarTrans,
    ifnull(ccsrs.target_quantity,0) as sDTarQty,
    ifnull(ccsrs.target_footfalls,0) as sDTarFF
    FROM
    cust_conv_store_report ccsr
    inner join cust_conv_store_report_summary ccsrs on(ccsrs.brand_code=ccsr.brand_code and ccsrs.category=ccsr.category and
                                  ccsrs.store_date=ccsr.store_date and ccsrs.value_type=ccsr.value_type)
    WHERE
    ccsr.value_type='B' and
    ccsr.brand_code= ? AND
    ccsr.store_date = date_format(str_to_date(?,'%d/%m/%Y'),'%Y-%m-%d')
    AND HOUR((TIME(ccsr.transaction_time))) >= (?) AND HOUR((TIME(ccsr.transaction_time)))< (?)
    GROUP BY
    ccsr.brand_code
    ) cons;
    Edited by: 992887 on Mar 10, 2013 4:25 AM

    992887 wrote:
    Hi All,
    I am new to oracle.code below is NOT valid Oracle syntax.
    post results from valid Oracle SQL below
    SELECT * FROM V$VERSION;
    I have a requirement. i need to display sales fields for a particular time as below.
    Time    Sales
    6-7 3333
    7-8 45345
    8-9 546
    But the min time and max time are coming from different query and sales fields coming from different.Now i need to join both queries to get the results.But there is no common column.I tried with sub query there also i am getting error.Please find the queries and help me
    Hour Group Query:
    select
    time1.*,
    (select if (time_format(dt.curr_time, '%H') <
    time_format(ifnull((SELECT prop_value FROM cust_conv_properties c where prop_key = 'DayStartingTime'), '00:00:00'), '%H'),
    date_format(date_add(dt.curr_time, INTERVAL 0 DAY),'%d/%m/%Y'),
    date_format(dt.curr_time,'%d/%m/%Y')) as curr_date
    from
    (select concat(date_format(str_to_date('23/10/2011','%d/%m/%Y'),'%Y-%m-%d'), ' ', '00:00:00') as curr_time) dt) as report_date
    from
    (select
    -- 'S' temp,
    cast(min(cchg.from_hour) as unsigned) as min_value,
    cast(max(cchg.to_hour) as unsigned) as max_value,
    concat(concat(min(cchg.from_hour),''),'-',concat(max(cchg.to_hour),'')) as time_diff
    from
    cust_conv_hour_group as cchg
    where
    cchg.group_value in (SELECT distinct if(group_value = (SELECT min(group_value) FROM cust_conv_hour_group),
    (SELECT max(group_value) FROM cust_conv_hour_group), group_value-1) as group_value
    FROM cust_conv_hour_group c where from_hour <= cast(time_format('23:00:00','%H') as unsigned)
    and
    to_hour > cast(time_format('00:00:00','%H') as unsigned))
    group by
    cchg.group_value
    ) time1
    Sales Fields Query:
    SELECT
    if(count(cons.wr_tarSale)=0,0, cons.wr_tarSale) wr_tarSale,
    if(count(cons.wr_actSale)=0,0, cons.wr_actSale) wr_actSale,
    if(count(cons.wr_tarTrans)=0,0, cons.wr_tarTrans) wr_tarTrans,
    if(count(cons.wr_actTrans)=0,0, cons.wr_actTrans) wr_actTrans,
    if(count(cons.tarSale)=0,0, cons.tarSale) tarSale,
    if(count(cons.actSale)=0,0, cons.actSale) actSale,
    if(count(cons.varSale)=0,0, cons.varSale) varSale,
    if(count(cons.tarTrans)=0,0, cons.tarTrans) tarTrans,
    if(count(cons.actTrans)=0,0, cons.actTrans) actTrans,
    if(count(cons.actAds)=0,0, cons.actAds) actAds,
    if(count(cons.actUpt)=0,0, cons.actUpt) actUpt,
    if(count(cons.tarAds)=0,0, cons.tarAds) tarAds,
    if(count(cons.tarUpt)=0,0, cons.tarUpt) tarUpt,
    if(count(cons.actConv)=0,0, cons.actConv) actConv,
    if(count(cons.tarTplh)=0,0, cons.tarTplh) tarTplh,
    if(count(cons.actBlank1)=0,0, cons.actBlank1) actBlank1,
    if(count(cons.actBlank2)=0,0, cons.actBlank2) actBlank2,
    if(count(cons.actTplh)=0,0, cons.actTplh) actTplh,
    if(count(cons.sDTarSale)=0,0, cons.sDTarSale)sDTarSale,
    if(count(cons.sDTarTrans)=0,0, cons.sDTarTrans)sDTarTrans,
    if(count(cons.sDTarQty)=0,0, cons.sDTarQty)sDTarQty,
    if(count(cons.sDTarFF)=0,0, cons.sDTarFF)sDTarFF
    FROM
    SELECT
    ifnull(sum(ccsr.target_sale),0) wr_tarSale,
    ifnull(sum(ccsr.actual_sale),0) wr_actSale,
    ifnull(sum(ccsr.actual_transaction_count),0) wr_actTrans,
    ifnull(sum(ccsr.target_transaction_count),0) wr_tarTrans,
    round(ifnull(sum(ccsr.target_sale),0),2) tarSale,
    round(ifnull(sum(ccsr.actual_sale),0),2) actSale,
    round(round(ifnull(sum(ccsr.actual_sale),0),2)- round(ifnull(sum(ccsr.target_sale),0),2),2) varSale,
    round(ifnull(sum(ccsr.actual_transaction_count),0),0) actTrans,
    round(ifnull(sum(ccsr.target_transaction_count),0),0) tarTrans,
    0 actBlank1,
    round(ifnull((sum(ccsr.actual_sale)/sum(ccsr.actual_transaction_count)),0),2) actAds,
    round(ifnull((sum(ccsr.target_sale)/sum(ccsr.target_transaction_count)),0),2) tarAds,
    round(ifnull((sum(ccsr.actual_quantity)/sum(ccsr.actual_transaction_count)),0),2) actUpt,
    round(ifnull((sum(ccsr.target_quantity)/sum(ccsr.target_transaction_count)),0),2) tarUpt,
    round(ifnull((sum(ccsr.actual_transaction_count)/sum(ccsr.actual_footfalls))*100,0),2) actConv,
    0 actBlank2,
    0 actBlank3,
    round(ifnull((sum(ccsr.actual_footfalls)/sum(ccsr.actual_man_hours)),0),2) actTplh,
    round(ifnull((sum(ccsr.target_footfalls)/sum(ccsr.target_man_hours)),0),2) tarTplh,
    round(ifnull(ccsrs.target_sale,0),2) as sDTarSale,
    round(ifnull(ccsrs.target_transaction_count,0),0) as sDTarTrans,
    ifnull(ccsrs.target_quantity,0) as sDTarQty,
    ifnull(ccsrs.target_footfalls,0) as sDTarFF
    FROM
    cust_conv_store_report ccsr
    inner join cust_conv_store_report_summary ccsrs on(ccsrs.brand_code=ccsr.brand_code and ccsrs.category=ccsr.category and
                                  ccsrs.store_date=ccsr.store_date and ccsrs.value_type=ccsr.value_type)
    WHERE
    ccsr.value_type='B' and
    ccsr.brand_code= ? AND
    ccsr.store_date = date_format(str_to_date(?,'%d/%m/%Y'),'%Y-%m-%d')
    AND HOUR((TIME(ccsr.transaction_time))) >= (?) AND HOUR((TIME(ccsr.transaction_time)))< (?)
    GROUP BY
    ccsr.brand_code
    ) cons;
    Edited by: 992887 on Mar 10, 2013 4:25 AM

Maybe you are looking for

  • Bpm workspace redirection problem

    hi, i did a change in the Soa Suite Server to make able to Ip Address and not for the dns alias. My problem happen when try to launch any application from bpm workspace. the launcher still pointing to localhost in human task. any ideas?

  • HD Strobe Of Death

    Hey Yeah! I am having the same problem I have been reading about on here allot, with my HD footage. The Dreaded Strobe! Everything I have read I have tried but nothing seems to work. I will Give you all the info On my Capture, and Camera and system:

  • Max Number of Procurement Proposal for a date

    We have scenario where a user has changed fixed lot size for a material 11,70,000 to 1 Pc. As result more than 2 Million Purchase requisitions got created by MRP. Is there any standard config settings, where we can maintain max number of procurement

  • Business Objects Audit Database

    Hi, I am part of spport team. BO was installed just 2 yrs back, We have about 15,000+ plus user and growing fast. Our current Audit DB is set up with main focus to monitor webi and CR. Due to large volume of data, ever 6 months we dump the audit data

  • Can I increase more storage for iPad if it is full

    Can I increase more storage in ipad if it is full.