Give the query  for  this requirement can we get it in correlated sub query

i have to query avg(someinfo) group by dayofthemonth for last three days
select someinfo from
(select avg(someinfo)from table tab
group by dayofdate1
where exists(select * from table
having max(date1)-tab.date1<3 )
how can we group day of the date1
someinfo date1
10 28-jun-2006
20 28-jun-2006
30 29-jun-2006
30 29-jun-2006
10 30-jun-2006
20 30-jun-2006
30 1-july-2006
40 1-july-2006
30 2-july-2006
40 2-july-2006
i have to query avg(someinfo) group by day for last three days
avg(someinfo) date1
35 2-jun-2006
35 1-july-2006
15 30-june-2006
here no need of union
Message was edited by:
user517983
Message was edited by:
user517983
Message was edited by:
user517983
Message was edited by:
user517983

SQL> CREATE TABLE t_table
  2  AS
  3 (SELECT 10 day ,'28-jun-2006' ft FROM dual
  4  UNION
  5  SELECT 20,'28-jun-2006' FROM dual
  6  UNION
  7  SELECT 30,'29-jun-2006' FROM dual
  8  UNION
  9  SELECT 30,'29-jun-2006' FROM dual
10  UNION
11  SELECT 10,'30-jun-2006' FROM dual
12  UNION
13  SELECT 20,'30-jun-2006' FROM dual
14  UNION
15  SELECT 30,'1-jul-2006' FROM dual
16  UNION
17  SELECT 40,'1-jul-2006' FROM dual
18  UNION
19  SELECT 30,'2-jul-2006' FROM dual
20  UNION
21  SELECT 40,'2-jul-2006' FROM dual)
22  .
SQL> /
Table created.
SQL> DESC t_table
Name                                                  Null?    Type
DAY                                                            NUMBER
FT                                                             VARCHAR2(11)
SQL> SELECT * FROM t_table;
       DAY FT
        10 28-jun-2006
        10 30-jun-2006
        20 28-jun-2006
        20 30-jun-2006
        30 1-jul-2006
        30 2-jul-2006
        30 29-jun-2006
        40 1-jul-2006
        40 2-jul-2006
9 rows selected.
SQL> SELECT day,ft FROM (SELECT AVG(day) day,ft FROM t_table GROUP BY ft ORDER BY ft DESC)
  2  WHERE ROWNUM<=3;
       DAY FT
        15 30-jun-2006
        30 29-jun-2006
        15 28-jun-2006Khurram

Similar Messages

  • Pls give me the solution for this requirement

    Hi experts ,
    pls give me the solution for this requirement
    what we have to do when basis guys are tranported my object to the production without completting . how can we rectiify this .
    thanks in advance

    Hi
    After Transporting a request or released a request you cant do any thing in that so now you have to create a new Transport request for your report continue with that. After completion transport it . It will makes no difference it will just over write already existing report
    Reward alll helpfull answers
    Regards
    Pavan

  • Hi. my laptop was reformatted recently, and my itunes there erased. i created a new one but the problem is it doesn't sync with my ipod anymore. what is the solution for this? can someone give me a tip? will really appreciate. thanks

    hi. my laptop was reformatted recently, and my itunes there erased. i created a new one but the problem is it doesn't sync with my ipod anymore. what is the solution for this? can someone give me a tip? will really appreciate. thanks

    Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities

  • HT201441 Hi I bought a second-hand phone iphone4, I update the software when you want to activate the phone asked for my registration icloud I do not know what is the password for this registration, can you tell me how to go to the next step without such

    Hi I bought a second-hand phone iphone4, I update the software when you want to activate the phone asked for my registration icloud I do not know what is the password for this registration, can you tell me how to go to the next step without such registration in icloud
    my ICCID is 8935905000307066111

    Unfortunately, you cannot do very much with your phone unless you get assistance from the previous owner, they should either provide you with the password to unlock it or remove their account from the phone entirely remotely through iCloud.com > Find My Phone.

  • REGARDING SCRIPTS.... CAN ANY ONE GIVE THE SOLUTION FOR THIS

    I have copied the standard script ML_SERVICE_ENTRY to ZFORM.... in tcode se71 but it has its original lang. - DE and lang - EN , if i get into this ZFORM ...
    in change mode,  the creation of windows, windows allignment and convert original lang. are in disabled mode , here i have to change the window size to add some text , is there any other method to change the language and to get these things in
    enable mode. plz give some solution for this one.

    Hi Mohan,
    While copying itself U have to give the Language in which U want to maintain, else U are supposed login in with the original Language only.
    Regards,
    Mohan
    *Reward if helpful*

  • Could you please suggest me the scenario for this requirement ?

    In module booking process we need the following process
    1.Student select their interested event package via website.
    2.Advisor review the student's event package list.
           2.1 In case of REJECT : student need to revise their list
           2.2 In case of APPROVE : all event package have confirm and run fee calculation.
    The information above is shortly requirement , if any one have suggestion for this requirement please suggest me.

    Vorad,
    I have some suggestions for you:
    1.  Create the module/event booking with 'Manual Conditional' flag.  Then, when the advisor approves a booking, remove the conditional flag.  If the advisor rejects, cancel the booking.  Here, you need to create some kind of UI for the advisor to review and approve/reject the requests.
    OR
    2.  Create the booking using a booking status such as 'pre-booked'.
    OR
    3.  Don't create any bookings from the student side.  Just create a booking plan instead.
    OR
    4. Look at a subtle process change that would let you use more out-of-the-box user interfaces/processes.  Students simply request special booking authorization for the event packages they want.  This automatically sends workflow approval messages to the advisor.  Then, just have a general rule which blocks all bookings that don't have this special authorization.   Once the student has a special booking authorization, he can just go into the course registration self-service and book the approved event packages.
    Michael

  • How to form a query for this requirment

    Hi Friends,
    I have a database table in which I store the employee data along with his phone number. Now this row of data can repeat for different phone number depending on if it is office phone or home phone or cell phone.
    But in the output of query, I need name of empoyee and other three columns namely "Home Phone", "Office Phone" and "Cell Phone".
    If employee has three rows for each kind of phone, then in the result of query all three columns for phone numbers should be filled, otherwise as many columns should be filled with data as different phone numbers employee has.
    Can any one please post SQL query for this scenario ?
    Thanks in Adavance

    I cannot imagine, that second and third query are
    under any circumstances faster as first one, but i
    can imagine that they are slower You stated that query without the inline view can only be faster. Did you check on optimizer plans or use tkprof to verify your claim?
    A quick check on those two selects
    SELECT object_id, object_type, object_name
      FROM user_objects;
    SELECT object_id, object_type, object_name
      FROM (SELECT object_id, object_type, object_name
              FROM user_objects)
              ;didn't show any changes in the explain plan unter 10g1.
    C.

  • What can be the SQL Query for this requirement ?

    Hi,
    I have a table with fields like this:
    ID DESC PARENT
    01 ABC 02
    02 ABC1 01
    03 ABC2 01
    04 ABC4 02
    In the above table PARENT column refers to ID column , but actually in SQL query i want to have ID, DESC , and PARENTDESC (i.e., desc value of the corresponding ID)
    Actual output that i need is
    select ID , DESC , ?? from table where ID=someValue . Now if i provide ID=01 then output should be like this:
    ID DESC PARDESC
    01 ABC ABC1
    Can anyone help what can be the required sql query ?
    Edited by: bootstrap on Apr 29, 2011 6:15 AM

    SELECT T1.ID, T1.DESC, T2.DESC
    FROM TABLEA T1, TABLEA T2
    WHERE T1.ID='01'
    AND T2.ID = T1.PARENT;

  • What's the fix for this error: Can't create the file "feed.xml."

    I try to publish my site from iWeb but I get an error which is below.
    Publish Error
    Can’t create the file “feed.xml.” The disk may be damaged or full, or you may not have sufficient access privileges.
    Anyone know the fix?

    Whether 'feed.xml' is the first file it is trying to upload, indicating a general failure to connect, or whether it's choked at that particular point would be the question. It would be worth your getting an FTP program if you don't already have one - Cyberduck is free - and checking whether any files at all have been uploaded.
    Is this the first time you've tried to publish or are you updating an existing site? If it's the first you should check carefully that your settings are correct, in particular the 'path' which varies between different hosts and may be blank or may be something like 'public.html' or 'htdocs' - this would lead to the actual webspace which may not be the root level as you access the FTP server.
    You could also try publishing to a local folder - create a special folder somewhere and specify it when setting iWeb to do this, check the contents are OK, then upload the contents of the folder (not the folder itself) using Cyberduck.

  • I bought a book. It closes within a minute of opening. I can not use it. Is there support for this or can I get a refund?

    I do not have this problem with any other book. Is there a recourse or a way to get help?

    when I check guarantee info from apple website, the following information is listed.
    i think, it is authorized and under guarantee.
    Valid Purchase Date
    A validated purchase date lets Apple quickly find your product and provide the help you need.
    Telephone Technical Support: Active
    Your product is eligible for complimentary telephone technical support during the first 90 days.
    Estimated Expiration Date: 04 July 2014
    More about complimentary support
    Contact Apple Support
    Repairs and Service Coverage: Active
    Your product is covered for eligible hardware repairs and service under Apple's Limited Warranty.
    Estimated Expiration Date: 04 April 2016
    Learn about Apple's coverage information for your product.

  • Please provide the abap code for this requirement

    note : if the below mentioned user exit is not suitable please find the suitable user exit and provide the code for this requirement.
    •     The User-exit MEFLD004 is only to be used at PO level (ME21N/ME22N).
    •     When PO is create or changed (ekko-ebeln) user exit MEFLD004 is triggered which check for the business requirement of the PO check for PO doc types (ekko-bsart) :z4,z6,z11,z12 from the table ekko and Account Assignment Category (knttp) is either N or K then stock process follows.  
    •     When an PO is cancelled, all entries will have to be reversed
    •     The Buffer table for the PO will have the following fields:
    Purchase order Number                     EKKO-EBELN
    Line item number of the PO               EKPO-EBELP
    Vendor Number                                  EKKO-LIFNR
    PO Quantity                                        EKPO-MENGE
    PO Nett Price                                     EKPO-NETPR
    Base Unit of Measure                  EKPO-LMEIN
    Account Assignment Category          EKPO-KNTTP
    PO Doc type                       EKPO-BSART     
    Plant                            EKPO-WERKS     
    Purchase Org                                  EKKO-EKORG
    Purchase Group                    EKKO-EKGRP     
    Company code                                EKPO-WAERS
    Item category                     EKPO-PSTYP
    PO Doc Date                      EKKO-BEDAT
    •     No duplications are allowed for any created, changed or cancelled purchase orders. If such a case occurs, the record will be updated with the latest update time stamp. This custom table will be keyed by purchase order number.

    Cross-post: http://forum.java.sun.com/thread.jspa?threadID=763485

  • Cisco TCS "the overview for this server cannot be found"

    Hi,
    I have a problem on my TCS server, a message is displayed "The overview for this server can not be found"
    This error message appears when I last reinstalling the usb image provided by Cisco,
    Thank's
    Billel

    Hello Billel -
    I presume because you mention USB image, you're running a 3rd generation TCS appliance?
    Have you tried to repair the TCS application through Add/Remove Programs to see if that resolves the issue?  I've had that issue myself once on a 2nd Generation TCS appliance, I tried a repair and uninstall/reinstall of the TCS application, eventually managed to get it back up and running, though I don't recall my actual steps.
    Also just in case, because you did a reimage, did you back up the serial number, checksup, and release/option keys from the registry located in HKLM > SOFTWARE > Wow6432Node > TANDBERG > TCS.  If you're missing any of that, you can obtain release and options keys from Cisco License Portal, select "Get Other Licenses", then "TelePresence Licenses to Resend".  You can get the checksum by contact TAC.

  • Need help in correlated sub query logic

    Hi ,
    I have one procedure with cursor. I have given small part of the cursor as shown below .
    SELECT
      A.DAY_DATE,
      A.COUNTRY_CODE,
      A.INST_CODE,
      a.bra_code,
      a.cus_num,
      a.cur_code,
      a.led_code,
      a.sub_acct_code,
      (tra_amt * SPOT_RATE) pre_day_crnt_bal,
      t.mat_date,
      t.NEW_INT_RATE int_rate,
      t.DEB_CRE_IND int_chg_pai_ind,
      a.ACCT_TYPE,
      (SELECT COUNT (
      DISTINCT TO_CHAR (day_date, 'mm')
      FROM PIO_TIMES
      WHERE day_date BETWEEN a.day_date
      AND NVL ( T.MAT_DATE,A.DAY_DATE) 
      AND TO_CHAR (day_date, 'dd') = '31') Test
    Here how can I build the logic for inside select statement.
    I tried to build the separate stream for the inside select statement but I am confusing how to handle the count in the inside the query.
    Please help me how to build the logic for the inside query statement .
    Thanks & Regards,
    Ramana.

    Hi Balakrishna,
    Thanks for your support
    I have applied but I am not getting the column in the output columns from the custom sql function.
    As per the procedure we are using the all conditions like between and month or date conditions  to find the count of distinct months.
    If we use partial conditional in the custom SQL  and partial conditionals in the lookup condition clause is it give the same result?
    How can we get the field of custom sql in the output field.
    Thanks & Regards,
    Ramana.

  • HT204003 if i open passbook on iphone 5, it always say cannot connect to itunes, any fix from apple tech support? and whats the reason for this problem? why do we have to figure it out and not even apple can give answer??

    if i open passbook on iphone 5, it always say cannot connect to itunes, any fix from apple tech support? and whats the reason for this problem? why do we have to figure it out and not even apple can give answer??

    actually i found out how to fix it
    1 sign out of apple account
    2 close down passbook app
    3 change year to 2013
    4 reopen passbook and sign in at the button with your apple ID
    5 change the time to auto update and it should work from now on.
    this worked for me let me know if it work for you:)

  • I have a requirement where I have to give the list of users who can access a specific computer. I am new with PS. Do you have a script to list users that can access a computer object of AD ?

    I have a requirement where I have to give the list of users who can access a specific computer define in AD.
    I am new with PS.
    Do you have a script to list users that can access a computer object of AD ?
    I have executed the following script  but it does not give me the access rights of who can access the computer 'computername'
    How can i have this information. please help
    Import-Module activedirectory
    $computer=get-adcomputer "computername" -properties ntSecurityDescriptor
    $omputer.ntsecurityDescriptor.Access | select-object -expandproperty IdentityReference | sort-object -unique

    I would say that, since the OP has so little info, there are no policies in use.  It there were then this question would never be asked the way it is being asked.
    I had a client call with a letter from their insurance company; an accountant with malpractice insurance.  THey asked the same question inmuch the same way.  "What computer can you users access?"  The question should be more like
    "Do you have a policy that restricts access to computers and do you audit for compliance?"
    I have had other clients whose insurance asked the question in that way.  It produces a better view of what should be happening and how to show compliance.
    I recommend that companies being asked these questions by their legal departments or insurance companies should contract with a god computer security consultant to assist with answering these very tricky questions.  Of course if it is just you boss's
    curiosity  then you may need to discuss his requirements with him in more depth.
    ¯\_(ツ)_/¯

Maybe you are looking for

  • How to restrict VL03N by Sales Office

    Dear Expert, We want to limit certain users to view Delivery Order by certain Sales Office. Have try to add V_VBKA_VKO in the role but not working. Cheers.

  • Mapping tool: mapping child nodes (level2 hierarchy) to bapi wrapper fields

    Hi, I'm new to MI7.1. I'll try the demo on help.sap.com. I have following data object EQUIPMENT with node structure in DOE: ROOTNODE (attr: EQUIPMENT_ID/ SERIAL_NO)    child node level 1 DETAILS (attr: SERIAL_NO/TYPE/BRAND/INSTRUCTIONS)        child

  • Run a client-side program when using web-enabled forms(host command)

    I am trying to run a local program on my windows machine when i press a button on the oracle web form SCAN[Host('C:\scktscan.exe')]. It trys to execute the program on the server machine and not the client machine. The button will work when forms are

  • Remove spaces and special characters from a form field

    Hi, I am tragically new to all of this, but am trying to create a form in Adobe Acrobat 9.  I am trying to use a Custom Format script to take inputs in a form field and automatically remove spaces and special characters (hyphens specifically).  For e

  • CS5 Master Suite Packaging

    I'm really not impressed.. the packaging for this software is so Mickey Mouse it should be embarassing for Adobe. I mean for a 1000.00 upgrade you would think that they'd at least provide you with a plastic DVD protective case. The box that the DVD's