Query on top of query

Hi All,
If it possible in WEBI, Can we create query on the top of the query in WEBI. I checked in sub query but it is query in the query.
select distinct DESK.fintransact from
(select distinct Top.fintransact, (Top.credit - Top.debit) as Amount
   From
Iowa.findetail Top
  inner join Iowa.fintransact Bug on Bug.fintransact = Top.fintransact
where (Top.account='10690 30115075' or   Iowa.SAPAccountCode(Top.account) = '30115075')
                                                     AND (Bug.SUBLEDGER <> 'CD' AND Bug.SUBLEDGER <> 'CR' AND Bug.SUBLEDGER <> 'AP' AND Top.TRANSACTIONTYPE <> 'AP')
  and Bug.ACCTDATE  BETWEEN  to_date(@Prompt('Enter the  Account Beginning Date (MM/DD/YYYY) ','A',,mono,free),'MM/DD/YYYY') AND to_date(@Prompt('Enter the Account Ending Date (MM/DD/YYYY) ','A',,mono,free),'MM/DD/YYYY')
  and  Bug.COMPANY IN @Prompt('Iowa Health Name(s) or * for All','A','Sales Recap\Company',multi,free) OR ('*' IN @Prompt('Iowa Health Name(s) or * for All','A','Sales Recap\Company',multi,free))
) DESK
group by DESK.fintransact having sum(DESK.amount) = 0 
The issue is the Inside query contains 2 objects Top.fintransact, (Top.credit - Top.debit) as Amount with the following results for date range
Inside Query
Top.fintransact Amount
204213 0
204093 0
204091 99595.01
203431 32332.91
322452 0
342342 33516.88
65765 0
Top Query
Top.fintransact Amount
204213 0
204093 0
322452 0
65765 0
I tried different way like Result from another query. I should feed the Top query result to another query.

Thanks a lot your query worked and I can see exact data.
Could please help me in the following code this bit different which is in Custom SQL. In the code in the From Clause there is a code which acts as Table . How can I achieve this in WEBI as  a single .
SELECT DISTINCT
  PENDETAIL.TRADE,
  PENDETAIL.PRODUCT,
  PENTRANSACT.ACCTDATE,
  PENDETAIL.PENTRANSACT,
  PENTRANSACT.SAP_DOCUMENT_NO,
  PENDETAIL.ACCOUNT,
  Iowa.SAPAccountCode(PENDETAIL.ACCOUNT) sapact,
  PENDETAIL.COUNTERPARTY,
  PENDETAIL.QUANTITY,     
  PENDETAIL.CREDIT,
  PENDETAIL.DEBIT,
  SHIPMENTPENDTL.VESSEL,
  PENDETAIL.DESCRIPTION,
  (( PENDETAIL.CREDIT ) - ( PENDETAIL.DEBIT )) amt,
  COUNTERPARTY_PENCP.SIC,
  Iowa.SAPProfitCenter(PENDETAIL.ACCOUNT) a,
  PENTRANSACT.COMPANY,
  PENDETAIL.SHIPMENT,
  PENDETAIL.SUBLEDGER,
  NVL(PENDETAIL.CONTRACT,DEV_GROSS_LENGTH_DETAIL.CONTRACT),
  PENDETAIL.PENDETAIL,
  PENDETAIL.QUANTITYSTATUS,
  PENDETAIL.QUALITY
FROM
  PENDETAIL,
  PENTRANSACT,
  SHIPMENT  SHIPMENTPENDTL,
  COUNTERPARTY  COUNTERPARTY_PENCP,
  (Select distinct shipment, contract from PENdetail where contract is not null) DEV_GROSS_LENGTH_DETAIL
WHERE
  ( PENTRANSACT.PENTRANSACT=PENDETAIL.PENTRANSACT  )
  AND  ( SHIPMENTPENDTL.SHIPMENT(+)=PENDETAIL.SHIPMENT  )
  AND  ( PENDETAIL.SHIPMENT = DEV_GROSS_LENGTH_DETAIL.SHIPMENT)
  AND  ( COUNTERPARTY_PENCP.COUNTERPARTY=PENTRANSACT.COMPANY  )
  AND  (
  PENTRANSACT.ACCTDATE  BETWEEN  @variable('Enter the Beginning Date (MM/DD/YYYY)') AND @variable('Enter the Ending Date (MM/DD/YYYY)')
  AND  Iowa.SAPAccountCode(PENDETAIL.ACCOUNT)  IN  ('30110075', '30115075', '40110075', '40115075')
  AND  PENTRANSACT.COMPANY  IN  @variable('Enter Company Name')
In the code the difference is in the FROM Clause which acts a table :
  (Select distinct shipment, contract from PENdetail where contract is not null) DEV_GROSS_LENGTH_DETAIL
In Where clause:
AND  ( PENDETAIL.SHIPMENT = DEV_GROSS_LENGTH_DETAIL.SHIPMENT)
Select  Clause:
  NVL(PENDETAIL.CONTRACT,DEV_GROSS_LENGTH_DETAIL.CONTRACT),
For some code I think there is no need of derived table I guess.

Similar Messages

  • Displaying the result of the TOP N query

    Hi all,
    we are facing a challenging task were we are going to build a query that gives the answer on the question:
    How many different materials (of the top sold) represent 80% of the total sales in quantity?
    The result should of the query should be very short:
                                                                                    2002           2003             2004
    Nr of materials 
    reps 80%          432            453               499
    The query is build on a CO-PA based cube, where each line corresponds to a billing item with material and quantity.
    By using a Top 80% condition on the quantity sold keyfigure we get out the top 80% materials sold:
    Year     Material     QTYSold        QTYSold-Ranked 
    2002     Mtr0323      10000             1
             Mtr0262      9000              2
             Mtr0243      8700              3
             Mtr0763      600               423
             Result       932000            423
    2003     Mtr0123      9700              1
             Mtr0332      9100              2
             Mtr0243      8700              3
            Mtr0763      543               453
             Result       912000            453
    We would like to supress the materials and only show the result row (or the raked position of the last material).
    The problem is that the 'Calculate Single Value As' properties of a formula (or keyfigure) only applies on Displayed Data values. All tests we have done so far with 'supression of zeros' & 'always hide' has messed up or counting / ranking functions.
    Is there any function in within formulas that have same functionality like Count,Rank etc?
    Is there any other way to supress materials and only show results?
    Any suggestions are welcome!

    Irina,
    Should be achievable using exception aggregation and pre-query.
    Create a query that gives the list of material that account for 80% of the sales using condition on the sales column.
    In the second query, using exception aggregation, count the number of materials that make up this set for the year. Create a new calculated key figure with the formula as qual to sales key figure. In the properties window, press the enhance button and select count of all values in the first drop down and material in the second drop down. Filter the query on material with a characteristic variable with processing as replacement path. In the variable point it to the first query. Drilldown for this will be year.
    This will give you number of materials for one year. If you want comparitive for three years, then three pre-queries and three variables with the calculated key figure restricted to a variable pointing to one years query.
    You can use pre-calculated value sets to improve the run for the result query.
    Cheers
    Aneesh

  • SQL Query for TOP 10 Average CPU

    Have a SCOM Report request for a line graph showing top 10 average CPU for a group of servers. I have a query that will show all of the servers in a group for the last day, with the average CPU by hour. How can I extend the SQL query to only select the TOP
    10 average CPU from the group? Here is the Query I have:
    SELECT
    vPerf.DateTime,
    vPerf.SampleCount,
    cast(vPerf.AverageValue as numeric(10,2)) as AverageCPU,
    vPerformanceRuleInstance.InstanceName,
    vManagedEntity.Path,
    vPerformanceRule.ObjectName,
     vPerformanceRule.CounterName
    FROM Perf.vPerfHourly AS vPerf INNER JOIN
     vPerformanceRuleInstance ON vPerformanceRuleInstance.PerformanceRuleInstanceRowId = vPerf.PerformanceRuleInstanceRowId INNER JOIN
     vManagedEntity ON vPerf.ManagedEntityRowId = vManagedEntity.ManagedEntityRowId INNER JOIN
     vPerformanceRule ON vPerformanceRuleInstance.RuleRowId = vPerformanceRule.RuleRowId
    WHERE
    vPerf.DateTime  >= DATEADD(Day, -1, GetDate())
    AND vPerformanceRule.ObjectName like '%Processor Information%'
    AND vPerformanceRuleInstance.InstanceName = '_Total'
    AND (vPerformanceRule.CounterName IN ('% Processor Time'))
    AND (vManagedEntity.Path IN (SELECT dbo.vManagedEntity.Name
    FROM dbo.vManagedEntity INNER JOIN
    dbo.vRelationship On dbo.vManagedEntity.ManagedEntityRowId = dbo.vRelationship.TargetManagedEntityRowId INNER JOIN
    dbo.vManagedEntity As CompGroup On dbo.vRelationship.SourcemanagedEntityRowId = CompGroup.ManagedEntityRowId
    WHERE CompGroup.DisplayName = 'bemis ibb prod'
    ORDER BY path, vPerf.DateTime
    Results
    DateTime
    SampleCount
    AverageCPU
    InstanceName
    Path
    ObjectName
    CounterName
    2/26/15 3:00 PM
    2
    1.98
    _Total
    servername.corp.com
    Processor Information
    % Processor Time
    2/26/15 4:00 PM
    2
    2.09
    _Total
    servername.corp.com
    Processor Information
    % Processor Time
    2/26/15 5:00 PM
    2
    1.72
    _Total
    servername.corp.com
    Processor Information
    % Processor Time
    2/26/15 6:00 PM
    2
    1.83
    _Total
    servername.corp.com
    Processor Information
    % Processor Time
    Thanks in Advance!
    Mike Hanlon

    Hi 
    Sql Query
    SELECT TOP 10
    vPerf.DateTime,
    vPerf.SampleCount, 
    cast(vPerf.AverageValue as numeric(10,2)) as AverageCPU,
    vPerformanceRuleInstance.InstanceName, 
    vManagedEntity.Path, 
    vPerformanceRule.ObjectName, 
     vPerformanceRule.CounterName
    FROM Perf.vPerfHourly AS vPerf INNER JOIN
     vPerformanceRuleInstance ON vPerformanceRuleInstance.PerformanceRuleInstanceRowId = vPerf.PerformanceRuleInstanceRowId
    INNER JOIN
     vManagedEntity ON vPerf.ManagedEntityRowId = vManagedEntity.ManagedEntityRowId INNER JOIN
     vPerformanceRule ON vPerformanceRuleInstance.RuleRowId = vPerformanceRule.RuleRowId 
    WHERE 
    vPerf.DateTime  >= DATEADD(Day, -1, GetDate())
    AND vPerformanceRule.ObjectName like '%Processor Information%'
    AND vPerformanceRuleInstance.InstanceName = '_Total'
    AND (vPerformanceRule.CounterName IN ('% Processor Time'))
    AND (vManagedEntity.Path IN (SELECT dbo.vManagedEntity.Name
    FROM dbo.vManagedEntity INNER JOIN
    dbo.vRelationship On dbo.vManagedEntity.ManagedEntityRowId = dbo.vRelationship.TargetManagedEntityRowId INNER
    JOIN
    dbo.vManagedEntity As CompGroup On dbo.vRelationship.SourcemanagedEntityRowId = CompGroup.ManagedEntityRowId
    WHERE CompGroup.DisplayName = 'bemis ibb prod'
    ORDER BY path, vPerf.DateTime
    Regards
    sridhar v

  • Top N query giving error for oracle 8.0.6

    Dear All,
    We are executing this query SELECT XBLNR, WERKS, MATNR, MDV01, BACKFLQUANT, STATUS, SAPTIMESTAMP, PITSTIMESTAMP, PMTIMESTAMP, BATCH FROM (SELECT XBLNR, WERKS, MATNR, MDV01, BACKFLQUANT, STATUS, SAPTIMESTAMP, PITSTIMESTAMP, PMTIMESTAMP, BATCH FROM PMBPITS.PITS_UNITY WHERE STATUS = '01' ORDER BY PMTIMESTAMP) WHERE ROWNUM < 20
    on oracle 8.0.6 but this is giving the following error
    ora - 00907 missing right parenthesis error
    1. Is it that in the inner select we cannot use order by and where clause together.
    2. We also found that if we remove order by from inner select then the query is not giving error
    pls help . points will be awarded

    Hi,
    what ever the Aman said is correct. You check this is supported in 8.1.5, SQL allows you to embed the ORDER BY clause in a subquery and place the ROWNUM condition in the top-level query;
    'Top-N query' is a ORACLE 8i feature which is supported in SQL. However,
    Bug:855720 states the following:
    "PL/SQL does not support top-N queries (ORDER BY in SUBSELECT/SUBQUERY
    or VIEW. Since this feature is available in SQL, but not in PL/SQL,
    it has been logged as a Bug that will be fixed in 8.1.6."
    - Pavan Kumar N

  • Top N query with INLIST Iterator performance problem

    I have a top N query that is giving me problems on Oracle 11.2.0.3.
    First of all, I have a query like the following (simplified from the real query, but produces the same problem):
        select /*+ gather_plan_statistics */ * from
          select rowid
          from payer_subscription ps
          where  ps.subscription_status = :i_subscription_status
          and ps.merchant_id           = :merchant_id2
          order by transaction_date desc
        ) where rownum <= :i_rowcount; This query works well. It can very efficiently find me the top 10 rows for a massive data set, using an index on merchant_id, subscription_status, transaction_date.
        | Id  | Operation                     | Name        | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
        |   0 | SELECT STATEMENT              |             |      1 |        |     10 |00:00:00.01 |       4 |
        |*  1 |  COUNT STOPKEY                |             |      1 |        |     10 |00:00:00.01 |       4 |
        |   2 |   VIEW                        |             |      1 |     11 |     10 |00:00:00.01 |       4 |
        |*  3 |    INDEX RANGE SCAN DESCENDING| SODTEST2_IX |      1 |    100 |     10 |00:00:00.01 |       4 |
        -------------------------------------------------------------------------------------------------------As you can see the estimated actual rows at each stage are 10, which is correct.
    Now, I have a requirement to get the top N records for a set of merchant_Ids, so if I change the query to include two merchant_ids, the performance tanks:
        select /*+ gather_plan_statistics */ * from
          select  rowid
          from payer_subscription ps
          where  ps.subscription_status = :i_subscription_status
              and (ps.merchant_id = :merchant_id or
                   ps.merchant_id = :merchant_id2 )
          order by transaction_date desc
        ) where rownum <= :i_rowcount;
        | Id  | Operation               | Name        | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
        |   0 | SELECT STATEMENT        |             |      1 |        |     10 |00:00:00.17 |     178 |       |       |          |
        |*  1 |  COUNT STOPKEY          |             |      1 |        |     10 |00:00:00.17 |     178 |       |       |          |
        |   2 |   VIEW                  |             |      1 |    200 |     10 |00:00:00.17 |     178 |       |       |          |
        |*  3 |    SORT ORDER BY STOPKEY|             |      1 |    200 |     10 |00:00:00.17 |     178 |  2048 |  2048 | 2048  (0)|
        |   4 |     INLIST ITERATOR     |             |      1 |        |  42385 |00:00:00.10 |     178 |       |       |          |
        |*  5 |      INDEX RANGE SCAN   | SODTEST2_IX |      2 |    200 |  42385 |00:00:00.06 |     178 |       |       |          |Notice now that there are 42K rows coming out of the two index range scans - Oracle is no longer aborting the index range scan when it reaches 10 rows. What I thought would happen, is that Oracle would get at most 10 rows for each merchant_id, knowing that at most 10 rows are to be returned by the query. Then it would sort that 10 + 10 rows and output the top 10 based on the transaction date, but it refuses to do that.
    Does anyone know how I can get the performance of the first query, when I need to pass a list of merchants into the query? I could probably get the performance using a union all, but the list of merchants is variable, and could be anywhere between 1 or 2 to several 100, so that makes that a bit unworkable.

    Across the two merchants_id's there are about 42K rows (this is in test, on Prod there could be several million). In the first query example, Oracle can answer the query in about 4 logical IOs and without even doing a sort as it uses the index to scan and get the relevant rows in Oracle.
    In the second case, I hoped it would pull 10 rows for each merchant_id and then sort the resulting 20 rows to find the top 10 ordered by transaction_date, but instead it is scanning far more rows than it needs to.
    In my example, it takes 4 logical IOs to answer the first query, but ~ 170 to answer the second, while I think it is achievable in 8 or so. For example, this query does what I want, but it is not a feasible option due to how many merchant_id's I may have to deal with:
    select /*+ gather_plan_statistics */ *
    from
      select *
      from 
        select * from
          select  merchant_id, transaction_date
          from payer_subscription ps
          where  ps.subscription_status = :i_subscription_status
          and ps.merchant_id = :merchant_id
          order by transaction_date desc
        ) where rownum <= :i_rowcount
        union all
        select * from  
          select  merchant_id, transaction_date
          from payer_subscription ps
          where  ps.subscription_status = :i_subscription_status
          and ps.merchant_id = :merchant_id2
          order by transaction_date desc
        ) where rownum <= :i_rowcount
      ) order by transaction_date desc
    ) where rownum <= :i_rowcount;
    | Id  | Operation                          | Name        | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
    |   0 | SELECT STATEMENT                   |             |      1 |        |     10 |00:00:00.01 |    6 |          |       |          |
    |*  1 |  COUNT STOPKEY                     |             |      1 |        |     10 |00:00:00.01 |    6 |          |       |          |
    |   2 |   VIEW                             |             |      1 |     20 |     10 |00:00:00.01 |    6 |          |       |          |
    |*  3 |    SORT ORDER BY STOPKEY           |             |      1 |     20 |     10 |00:00:00.01 |    6 |  2048 |  2048 | 2048  (0)|
    |   4 |     VIEW                           |             |      1 |     20 |     20 |00:00:00.01 |    6 |          |       |          |
    |   5 |      UNION-ALL                     |             |      1 |        |     20 |00:00:00.01 |    6 |          |       |          |
    |*  6 |       COUNT STOPKEY                |             |      1 |        |     10 |00:00:00.01 |    3 |          |       |          |
    |   7 |        VIEW                        |             |      1 |    100 |     10 |00:00:00.01 |    3 |          |       |          |
    |*  8 |         INDEX RANGE SCAN DESCENDING| SODTEST2_IX |      1 |    100 |     10 |00:00:00.01 |    3 |          |       |          |
    |*  9 |       COUNT STOPKEY                |             |      1 |        |     10 |00:00:00.01 |    3 |          |       |          |
    |  10 |        VIEW                        |             |      1 |     11 |     10 |00:00:00.01 |    3 |          |       |          |
    |* 11 |         INDEX RANGE SCAN DESCENDING| SODTEST2_IX |      1 |    100 |     10 |00:00:00.01 |    3 |          |       |          |
    ---------------------------------------------------------------------------------------------------------------------------------------This UNION ALL query completes in 6 logical IOs - the original query I posted with 2 IDs takes 178 to return the same results.

  • Unwanted LOVs - Universe on a BEx query on top of a Multiprovider

    BO XI 3.1
    BW 7.01
    OLAP Universe on a BEx query
    BEx query on top of a Multiprovider
    Multiprovider on 2 DSOs; lets say DSO1 and DSO2
    BEx query has a global filter for "INFOPROVIDER = DSO1"
    BEx query has a user input variable defined for "Field1" (Field1 is present in both DSOs)
    In BEx, F4 on Field1 variable entry gives the values of Field1 from DSO1. (which is what we want)
    Expected LOVs for the generated prompt for Field1 in the WEBI report: Values of Field1 from DSO1
    Problem:
    Actual LOVs returned in WEBI report: Values of Field1 from both DSO1 and DSO2
    Has anyone faced this before?
    Thank you

    Henry Banks wrote:
    > I have a suspicion the BEX property 'only values in infoprovider' isn't picked up/consumed by the BAPIs used by the MDX interface.
    That is correct. The BEx properties do not carry over to the BO side. In Webi 3.1 here are the default selections for LOVs (as far as I know)
    OLAP universe against BEx query on an infoprovider (Infocube, DSO, Multiprovider) - Only values in Infoprovider
    OLAP universe against BEx query on an Infoset - Values in the master data table
    My understanding now is
    OLAP universe against BEx query on a Multiprovider - Only values in ALL Infoproviders under the Multiprovider
    Henry Banks wrote:
    > Yes, this is confirmed by Note 1224318 - MDX: InfoProvider restriction for the member rowset
    > It's a BW limitation of the OLE DB for OLAP.
    I have seen this note before and according to it you can set an RSADMIN parameter MDX_JOIN_CUBE_DIME and have more control over the LOVs.
    MDX_JOIN_CUBE_DIME = "A" -> The read mode for all LOVs is Only values in master data
    MDX_JOIN_CUBE_DIME = "I" -> The read mode for LOVs is either master data or infoprovider depending on the infoobject settings
    Henry Banks wrote:
    > It might be easier to have to 2 data providers for this document, if you don't already, for plan and actual;  or 2 seperate bex queries.
    Well, that would work but it would defeat the purpose of having a Multiprovider for logical partitioning, wouldn't it?

  • Can we hide filter in Search Master agreements standard top level query?

    Hi Experts, 
    I have a requirement to hide flter in standard Search Master Agreements top level query.  See below screen shot
    I have an idea how to delete filter in query but when i have added that query to top level navigation i don't have any idea.
    So i want to hide Business Unit & Region filter in Search Master Agreement query when it is in top level navigation.
    If anyone have idea please share with me how to hide.
    Thanks,
    Lava

    Hi Lava,
    It is not a filter but this a Standard field which is coming from the Master Agreement.
    So, you cannot hide or even delete any field.
    But if it is a custom field you can hide it by inactivating the respective field in Extension Defination.
    Please let me know if you need any assistance.
    Thanks,
    Raj.

  • Top utilising Query in SQL server

    Hi,
       Is there any query to get the top utilization query of the day?

    Hi,
    Top CPU utilizing query
    --This might take some time to give result on busy systemselect top 10
    sum(qs.total_worker_time) as total_cpu_time,
    sum(qs.execution_count) as total_execution_count,
    count(*) as number_of_statements,
    t.text
    from
    sys.dm_exec_query_stats qs
    cross apply sys.dm_exec_sql_text(qs.sql_handle) as t
    group by t.text
    order by sum(qs.total_worker_time) desc
    For memory utilization there is no perfect way to find out if query has completed. but
    sys.dm_exec_query_memory_grants would help you
    SELECT mg.granted_memory_kb, mg.session_id, t.text, qp.query_plan
    FROM sys.dm_exec_query_memory_grants AS mg
    CROSS APPLY sys.dm_exec_sql_text(mg.sql_handle) AS t
    CROSS APPLY sys.dm_exec_query_plan(mg.plan_handle) AS qp
    ORDER BY 1 DESC OPTION (MAXDOP 1)
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
    My TechNet Wiki Articles

  • Gateway BOPF Integration - Support of query options $top, $skip, $inlinecount

    Hi Experts,
    I am using GBI to consume data from a BOPF BO via OData. For some special cases I need the query options $top, $skip and $inlinecount.
    But it seems that these query options are not supported until now (I have Component SAP_BS_FND 747 SP04 installed).
    Is that true? If yes, is it planned to support the query options in an upcoming version.
    Thx for your help.
    Florian

    Hello Florian,
    I cannot speak for GBI and I hope that someone else will have an answer for you. Still I hope that the following might help:
    As you are requesting for $top and $skip I guess(?) you have a read-only UI for a large number of entries. If this is the case, upcoming versions might offer a solution for you with SADL-based gateway services. Please refer to this post.
    Kind Regards,
    Ivo

  • Universe unable to access query on top of Multi-provider.

    Hi All,
    I have a multi-provider made of my custom cubes ,I have build a query on top of this multi-provider and while designing I have taken to put Tick 'ALLOW EXTERNAL ACCESS TO THIS QUERY'  but when i design universe give my login details i am not able to see that query ,folder for that multi-provider gets created but that query is not getting displayed... 
    I created a new query and did necessary things but i cant see that query built on top of this multiprovider.
    If i make a normal query on top of cube or dso i am able to see that query.
    I have other multiprovider if i create query on  that i can see that query in universe.
    I am surprised why this is happening ?
    I am using Business object XI 3.1, so i dnt think this is software issue
    Any one faced such kind of issue please reply.

    Thanks for the earliest reply.
    I can see the multiprovider in $infocube list.
    But query i am not able to...
    I have calculated key figures in my query but if that is the issue then i also made a simple query which just had standard key figures, then too i am not able to see that query.....
    In my other mullti provider I have calculated key figurre and i am able to see that query...
    I don't know what is the issue....anything else you can suggest..

  • Need help for top n query

    Hi,
    I want to show top 3 salary records from emp table and I am using below query in oracle * plus. However I am getting an error saying, "FROM keyword not found where expected". I am not getting what mistake I am doing while writing this query. Can someone plz advice?
    Query:
    Select top 3 sal from emp;
    Thanks in advance.

    Hi,
    In Oracle, there is no TOP keyword. The usual way to do a top-N query in Oracle is to use an analytic function, such as RANK:
    WITH     got_r_num     AS
         SELECT     sal
         ,     ename, empno, ...     -- whatever columns you want
         ,     RANK () OVER (ORDER BY sal DESC)    AS r_num
         FROM     scott.emp
    SELECT       sal
    ,       ename, empno, ...     -- if wanted
    ,       r_num                -- if wanted
    FROM       got_r_num
    WHERE       r_num     <= 3
    ORDER BY  sal
    ;Depending on how you want to handle ties, ypu may want to add tie-breaking columns to the end of the analytic ORDER BY clause, and/or use ROW_NUMBER instead of RANK.

  • Oracle query for top two salary of each group departmentwise

    oracle query for top two salary departmentwise

    sigh...
    But anyway,
    Top-n queries:
    http://www.oracle.com/technology/oramag/oracle/07-jan/o17asktom.html
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2853107469873
    and ofcourse lots of 'em here on OTN...

  • How to find top utilized query for last two months in oem

    how to find top utilized query for last two months in oracle enterprise manager?

    Can you mark the thread as Helpful  and once marked the information can be reviewed by other customer for similar queries
    Regards
    Krishnan

  • Creating a TOP N Query with a time reference

    Hello,
    how can i create a TOP 5 Query which is giving me the highest sales order changes in the sales amount during the last day.
    Following structure:
    Sales Order
    Extraction point
    Sales(Amount)
    I have already created a Top 5 Query which is giving me the 5 highest Sales order with the highest sales. But now i need a query which is giving me the 5 highest sales order during the last extraction point.
    Thanks for any advice
    Best regards

    Hi please try the below steps:
    1. create a formula variable on the extract point.
    2. Create a query only on Extract point as Char in row & formula keyfigure (FKF1) on the extract point formula variable.
    3. Create a condition of Top 5 on the FKF1 on the above query.
    4.Now come to your original query create a variable on the extract point char use the replacement path & select the query which you just created as the background query for this variable.
    So the background query will provide only the TOP 5 extract point values to your original query.
    Regards
    Mahendra

  • Delete component query from a super query

    Hi Experts,
    I need to delete a component query from a super query. Can Any one give the steps to persue..
    Thanks,
    Pilliga

    Hi,
    When you load the super query, the query is displayed in a tree-like structure and the queries are referred to as branches.
    In order to remove a component query from the super query, you must first select the parent operation (i.e. join or append), right click and select Delete Operation. You will then be prompted with a dialog box where you can specify to delete either the top or bottom branch (i.e. top or bottom query).
    Cheers,
    Tanish

Maybe you are looking for