Select Last  X days when execute query

Hello,
ı need  last N stop date of machines in my query, ı have stop date and when ı execute the query ı want to see just last 3 stop. have can ı make it?
the filters of my query  are: Fiscal Year and Fiscal Period.
ı cant give any condition because stop date is not key figure,has anyone any ideas??

you can create condition on the stop date irrespective of key figure or not.
Create the formual which has condition
( A  = B) * C + D
The above statment means:
If A = B
then Display C
or Display D.

Similar Messages

  • Select Last 7 days

    How can I select last 7 days from my table, I use query but it is calculating according to sysdate
    It is the data of my talble
    DP_DATE
    03-APR-10
    21-APR-10
    22-APR-10
    23-APR-10
    26-APR-10
    27-APR-10
    28-APR-10
    29-APR-10
    30-APR-10
    03-MAY-10
    04-MAY-10
    11 rows selected.
      select distinct dp_date
      from dailyprice
      where trunc(dp_date) between trunc(sysdate-7) and trunc(sysdate)
    this query is returning
    DP_DATE
    29-APR-10
    30-APR-10
    03-MAY-10
    04-MAY-10I want to select last 7 days
    26-APR-10
    27-APR-10
    28-APR-10
    29-APR-10
    30-APR-10
    03-MAY-10
    04-MAY-10
    kindly guide
    regards

    Hi,
    Kame wrote:
    with t
    as
    select 'abcFund' FND , to_date('09-MAY-10','dd-mon-rr') dpdate, 10 price from dual union all
    select 'dddFund', to_date('09-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'abcFund', to_date('09-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'edfFund', to_date('09-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'eeeFund', to_date('09-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'dddFund', to_date('08-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'abcFund', to_date('08-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'edfFund', to_date('08-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'eeeFund', to_date('08-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'eeeFund', to_date('08-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'dddFund', to_date('07-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'abcFund', to_date('07-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'edfFund', to_date('07-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'edfFund', to_date('05-MAY-10','dd-mon-rr'), 11 from dual union all
    select 'dddFund', to_date('05-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'eeeFund', to_date('05-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'dddFund', to_date('04-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'abcFund', to_date('04-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'dddFund', to_date('03-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'abcFund', to_date('03-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'edfFund', to_date('03-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'eeeFund', to_date('03-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'dddFund', to_date('01-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'abcFund', to_date('01-MAY-10','dd-mon-rr'), 12 from dual union all
    select 'abcFund', to_date('30-APR-10','dd-mon-rr'), 11 from dual
    )Hot to get my result from this data.What result is that?
    Do you mean what you posted in your first message?
    I want to select last 7 days
    26-APR-10
    27-APR-10
    28-APR-10
    29-APR-10
    30-APR-10
    03-MAY-10
    04-MAY-10The last thing I saw posted
    this query will not work in this situation
    select dp_date
    from ( select dp_date
    , row_number() over (order by dp_date desc) rn
    from mytable
    where rn <= 7ROW_NUMBER will get the 7 most recent rows , whether they all have the same dp_date, 7 different dp_dates, or anything in between.
    DENSE_RANK will get the 7 most recent values , whether they come from 7 rows or more.
    select DISTINCT
         dp_date
    from      (
              select      dp_date
              ,     DENSE_RANK () over (order by dp_date desc)      AS rn
              from      mytable
    where      rn     <= 7If you want the 7 most recent calendar days, then use TRUNC (dp_dtate) in the analytic function:
    DENSE_RANK () over (order by TRUNC (dp_date) desc)      AS rnThis will count (for example) these 3 distinct DATE values:
    6-May-2010 07:00
    6-May-2010 08:10
    6-May-2010 23:59
    all as one value.

  • When executing query...in the result i want to display each row values

    Hi All,
    When executing query...in the result area i want to display  each row values.
    Example:  query result is like this
    Business Area   Sales   Material 
    kh02                 1000      2000
                            2000       300
                            5000        400
                            6990       1000
    Kh03                1400        700
                             200        500
                              50          60
    but i need like this
    kh02               1000         2000
    kh02                500           600
    kh02                400           300
    kh03                1400         700
    kh03               200            500
    Why i need like this because am exporting to Excel spread sheet and i have to send as i show above ....i am doing manual but the file is very big like 95, 969 records i have to change manual...like this i have to change 8 files.
    please advice me easy way
    i willl be very gr8ful
    Thanks
    sidhartha

    Hi,
    that'S exactly what hide repeated key values does. If this option is on your result is:
    Kh02 1000 1500
    blank 500 456
    blank 600 700
    kh03 400 500
    balnk 500 600
    If you turn it off, the result will be:
    Kh02 1000 1500
    Kh02 500 456
    kh02 600 700
    kh03 400 500
    kh03 500 600
    Exaclty what you want. Try it, it should work
    Regards,
    Juergen

  • HELP! Safari 5.1.10 on OSX 10.6.8: All of a sudden in the last few days, when Safari is launched it is trying to load hundreds of pages at the same time, hanging up the whole computer

    HELP! Safari 5.1.10 on OSX 10.6.8: All of a sudden in the last few days, when Safari is launched it is trying to load hundreds of pages at the same time, hanging up the whole computer. What the heck happened?

    I misunderstood the settings. A few days ago I had tried to set it to open a specific page upon launch, and set "New windows open with: Bookmarks" instead of ":Homepage"

  • Error when executing query without passing variable selection

    Hi Gurus
    I am getting an error while executing a query with out passing values for variables
    When executing the query by passing the filter values report returns the data
    When executing the query with out passing variable selections the error message is
    Unknown error in SQL interface
    Error reading the data of Info Provider ZCRM_O08
    Error while reading data; navigation possible
    System error in program SSAPLRS_EXCEPTION and form
    RS_EXCEPTION_TO_MESSAGE
    No Data Available
    can any one please help me in resolving this
    Thank you

    Hi Srini
    Thanks for your quick response
    When i am executing the query with selection it is returning the data
    giving error when executing with out passing the selection
    is there any other cause for this problem
    like any particular info object causes this sort of problem
    Thank you

  • Getting error "Column is not indexed " when executing query on ORACLE 10g

    Hi all,
    When executing the below query im getting the error "ORA-20000:Column is not indexed"
    query:
    select xmlelement("nexml:result",xmlattributes('http://namespaces.nextance.com/nex/xml' as "xmlns:nexml"),xmlelement("nexml:value",count(*))).getClobVal()
    from "permission"
    where ( ((contains(object_value,'(searchDocument) inpath(/permission/action)') > 0)) and ((existsNode(object_value,'/permission[resource/resourcekey/@type[. = "document"]]') = 1)) and ((contains(object_value,'(GeneralUser) inpath(/permission/principal/@name)') > 0)) and ((existsNode(object_value,'/permission[principal/@type[. = "group"]]') = 1)) and ((existsNode(object_value,'/permission[type[. = "allow"]]') = 1)) and ((contains(object_value,'(nexip) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(Corporate) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(ProcurementAgreement) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(Procurement) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(SalesAgreement) inpath(/permission/resource/resourcekey/field/@value)') > 0)) )
    Then after checking some forum, i replaced "contains" with "ora:contains" and executed the query. Now im not getting the first error but got a new error "invalid relational operator"
    So please help me in resolving the errors?
    Thanks in advance.

    Anil kumar wrote:
    Hi,
    Thanks for your reply. Could you please explain your solution in detail?Hi,
    I just have a try...
    create table t (id int,my_lob clob)
    begin
    insert into t values(101,'Oracle redwood shores USA');
    insert into t values (102,'HP palo alto USA');
    insert into t values(103,'Capgemini  FRANCE');;
    end;
    create index my_idx on t(my_lob) indextype is ctxsys.context
    select *
    from t
    where contains(my_lob,'USA',1)>0
    Output
    ID      MY_LOB
    101     Oracle redwood shores USA
    102     HP palo alto USA Hope it helps,
    CKLP

  • Urgent! I get value when executing query of VO in page, but null in plsql.

    Hi, gentlemen,
    Please help me with this issue.
    1,My VO query sql is like this:
    SELECT acra.receipt_number as receipt_number,
    al_a.meaning as receipt_type, acra.currency_code as currency_code,
    acrha_a.amount as receipt_amount,
    acra.receipt_date as receipt_date,
    acrha_b.gl_date as gl_date,
    arm.NAME as payment_method,
    acra.doc_sequence_value as doc_sequence_value,
    al_b.meaning as status,
    acrha_a.acctd_amount as acctd_amount,
    rcta.trx_number as trx_number,
    rc.customer_name as customer_name,
    rc.customer_number as customer_number,
    rc.jgzz_fiscal_code as taxpayer_id,
    rsu.location as customer_site,
    acra.customer_receipt_reference as customer_ref,
    acra.comments as comments,
    acra.cash_receipt_id as cash_receipt_id
    FROM ar_receivable_applications_all araa,
    ar_cash_receipts_all acra,
    ar_lookups al_a,
    ar_cash_receipt_history_all acrha_a,
    ar_cash_receipt_history_all acrha_b,
    ar_receipt_methods arm,
    ar_lookups al_b,
    ra_customer_trx_all rcta,
    (SELECT hca.cust_account_id customer_id,
    hca.org_id org_id,
    hp.party_name customer_name,
    hca.account_number customer_number,
    hp.jgzz_fiscal_code
    FROM hz_cust_accounts_all hca, hz_parties hp
    WHERE hp.party_id = hca.party_id) rc,
    (SELECT site_use_id site_use_id,
    org_id org_id,
    cust_acct_site_id address_id,
    location location
    FROM hz_cust_site_uses_all) rsu
    WHERE araa.receivable_application_id = :1
    and acra.cash_receipt_id = araa.cash_receipt_id
    and al_a.lookup_type(+) = 'PAYMENT_CATEGORY_TYPE'
    AND al_a.lookup_code(+) = acra.TYPE
    AND acrha_a.cash_receipt_id = acra.cash_receipt_id
    AND acrha_a.current_record_flag = nvl('Y', acra.receipt_number)
    AND acrha_a.org_id = acra.org_id
    AND acrha_b.cash_receipt_id = acra.cash_receipt_id
    AND acrha_b.first_posted_record_flag(+) = 'Y'
    AND arm.receipt_method_id = acra.receipt_method_id
    AND al_b.lookup_type(+) = 'RECEIPT_CREATION_STATUS'
    AND al_b.lookup_code(+) = acra.status
    AND rcta.customer_trx_id(+) = acra.receivables_trx_id
    AND rcta.org_id(+) = acra.org_id
    AND rc.customer_id(+) = acra.pay_from_customer
    AND rc.org_id(+) = acra.org_id
    AND rsu.site_use_id(+) = acra.customer_site_use_id
    AND rsu.org_id(+) = acra.org_id
    2, I add the init func in VOImpl which is like this:
    the receiptApplicationId is 136877.
    public void initQuery(Number receiptApplicationId)
    setWhereClauseParams(null); // always reset
    setWhereClauseParam(0, receiptApplicationId);
    executeQuery();
    When executing the page, its value shows to be "現預金".
    And I used String receipt_type = (String)oaRow.getAttribute("ReceiptType"); in AMImpl, its value is "現預金".
    But when I execute above sql in pl/sql developer, its value is null.
    I am really confused with this.
    How could I get the whole running sql statement, and know why my issue is like this? It's very urgent, Thanks!

    This Query is Org Specific.(As this query using Ord_id attribute to fetch out row.)
    you need to set org_id at PLSQL Developer or Toad Level.
    Thanks, Avaneesh

  • I can't access my dial pad to make calls.   The last few days when I go to the phone a pop up appears that says "unfortunatly contacts has stopped working" after pressing ok to remove the pop up, it goes back to the home screen.  This also happens when I

    The last several days I have not been able to access the dial pad.  When I go to phone a pop up appears that says "unfortunatly contacts has stopped working."  To remove the pop up you have to hit 'ok', the it goes back to the home screen.  This also happens when I go to contacts. 

    You migh give resetting your NVRAM a try:
    http://support.apple.com/kb/ht1379

  • How to cancel a query when execute query builtin fire and No Records found.

    Hi,
    I am unable to cancel a query when i make query (fire enter-query) then fire (execute-query) and no records found then the form status is enter-query mode. Plz help me that how can i back to normal mode of form.
    here i use the code for coming back to enter-query to normal mode but no results.
         if :system.mode = 'ENTER-QUERY' THEN
    ABORT_QUERY;
         clear_form;          
         END IF;
    thanks in advance....

    Hello,
    I would test the record status of the first record in the block. If this status is 'NEW', then there is no record retrieved, so that you can exit the query mode with exit_form()
    Francois

  • To disable the calendar when executing query

    when executing the form the calendar is automatically displaying how to disable the calendar at querying the records
    thanks
    prasad

    Sorry but I could not understand clearly your question

  • Java.lang.StringIndexOutOfBoundsException when executing query on Oracle 9i

    SQL Deverloper Build 1467
    Windows XP
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    I have the following query being executed in SQL Worksheet.
    select * from address
    where address_id in (1, 2, 3, .... 1000, 1001);
    If I have <= 1000 expressions, it executes but if it has > 1000, the query does not return this error "ORA-01795: maximum number of expressions in a list is 1000". When I ran this it in console, it gave me this error. In oracle 10G it works fine.
    java.lang.StringIndexOutOfBoundsException: String index out of range: 16058
    at java.lang.String.substring(String.java:1765)
    at oracle.dbtools.raptor.scriptrunner.SQL.run(SQL.java:73)
    at oracle.dbtools.raptor.scriptrunner.ScriptRunner.run(ScriptRunner.java:116)
    at oracle.dbtools.raptor.scriptrunner.ScriptRunner.run(ScriptRunner.java:186)
    I think this is a bug in the 9i module.
    -Nags

    Anil kumar wrote:
    Hi,
    Thanks for your reply. Could you please explain your solution in detail?Hi,
    I just have a try...
    create table t (id int,my_lob clob)
    begin
    insert into t values(101,'Oracle redwood shores USA');
    insert into t values (102,'HP palo alto USA');
    insert into t values(103,'Capgemini  FRANCE');;
    end;
    create index my_idx on t(my_lob) indextype is ctxsys.context
    select *
    from t
    where contains(my_lob,'USA',1)>0
    Output
    ID      MY_LOB
    101     Oracle redwood shores USA
    102     HP palo alto USA Hope it helps,
    CKLP

  • Runtime Error when executing Query in the web

    Hello,
    when i try to execute a query on the  web, i get the error
    Exception in BI runtime
    Log ID: 005056BD15DA005E000000A900000A3400043C8F00E4DD8B
    Initial cause
    Message:
    'user' missing
    Stack trace:
    com.sap.mw.jco.JCO$Exception: (101) RFC_ERROR_PROGRAM: 'user' missing
    Message:
    No connection possible to BI master system VB0CLNT800
    Stack trace:
    com.sap.ip.bi.base.service.connection.ConnectionException: No connection possible to BI master system VB0CLNT800
    Can anyone please tell me , how to fix this ..
    Thanks
    Raj

    you mwy check this to trouble shoot front end
    Troubleshoot the SAP NetWeaver 2004s BI Frontend Installation

  • Calculated keyfigures not defined correctly error when executing query

    Hi Experts,
    I changed calculations in the calculated keyfigures and saved successfully.
    when I execute the query in BI7 Bex, I am getting errors like query element not defined correctly in the query. when I look into query in the designer its giving info messages for many calculated keyfigures saying reusable and saving can influence other queries.
    I reverted back the changes but the errors still coming up. I tried to copy the query and run it ..still didnt helped..
    Please suggest me with the solution..
    Quick replies are much appreciated and awarded.
    Thanks
    Vanaja

    Hi,
    The calculated keyfigure is the difference of two other calculated keyfigures...
    I tried to re-drag and drop into keyfigures column and didn't worked and still getting the errors.
    Please suggest some more..
    Thanks
    Vanaja

  • Java.sql.SQLException: ORA-00933: error when  executing query

    Hello,
    I am trying to execute the following query from a jsp page.
    String sqlUpdate ="UPDATE table_name SET name ='"+name+"', description='"+description+"', proj_link='" projlink"', active='" active"',sort_order='" order"',image='" image"',category='" category"', technology='" technology "' WHERE id="+id+" ";
    stmt.executeQuery(sqlUpdate);
    I get the follwoing error java.sql.SQLException: ORA-00933: SQL command not properly ended
    When I omit "description" from the query it executes fine. But when I place it back into the query I get the above error. The table is in Oracle database and the datatype of description id varchar2(4000). I declared all the variables used in the query, I then assigned values caught from the form and then am trying to update the form varibles in the table.
    Thanks,
    Nikky128

    Nikky128 wrote:
    Hello,
    I am trying to execute the following query from a jsp page.There's a big part of your problem. You shouldn't be doing database stuff in JSPs. If you must, you should be using JSTL and its <sql> tags.
    String sqlUpdate ="UPDATE table_name SET name ='"+name+"', description='"+description+"', proj_link='" projlink"', active='" active"',sort_order='" order"',image='" image"',category='" category"', technology='" technology "' WHERE id="+id+" ";Not using PreparedStatement here is just a silly noob error.
    When I omit "description" from the query it executes fine. But when I place it back into the query I get the above error. The table is in Oracle database and the datatype of description id varchar2(4000). I declared all the variables used in the query, I then assigned values caught from the form and then am trying to update the form varibles in the table.Probably a single or double quote that you can't see. PreparedStatement will eliminate that problem.
    %

  • "3.x Analyzer Server" EVENT taking more Time when Executing Query

    Hi All,
    When I am Executing the Query Through RSRT   taking more time. When I have checked the statistics
    and observed that "3.x Analyzer Server" EVENT taking more Time .
    What I have to do , How I will reduce this 3.x Analyzer Server EVENT time.
    Please Suggest me.
    Thanks,
    Kiran Manyam

    Hello,
    Chk this on query performance:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ce7fb368-0601-0010-64ba-fadc985a1f94
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/4c0ab590-0201-0010-bd9a-8332d8b4f09c
    Query Performance
    Reg,
    Dhanya

Maybe you are looking for

  • Server crashes when I do network "find"

    I have a network of five computers, three power PC's and two laptops. No matter which machine I attempt the "find" from, it automatically crashes the server. Any suggestions?

  • Flex FAQ 9-22-08

    Q: I want to use an XML data source to dynamically display images and data in my Flex application. I won't know how many images/data points I will have at design time. How can I best approach this? A: Depending on what you're wanting to do, you can e

  • Problem configuring Flickr in Lightroom 5

    First I needed to make IE my default browser. But when I accept the link with Lightroom whe requested, I'm sent to Windows Store and this time, there is no Lightroom application in Windows Store (of course)

  • Cover Flow in Safari

    My Safari appears to be working well with the exception of Top Sites and Cover Flow, though the latter works fine in iTunes. I'm not too worried about Top Sites, but I like the option of viewing my browsing history in Cover Flow. I've tried binning S

  • Cisco Prime 4.2, Inventory group management and reports group

    Hi I have created some groups under Inventory > Group Management > Device.  This works fine. Then I want to create a monthly report for Reports > Performance > Device > Availability.  Here I guessed I would find my groups created under inventory. But