Daily Max Value and Time of Max

Hi I need a little help.
I have a table like this -
date_time------------------------wind_speed------------direction
01-Jan-2010 09:00:00------------10------------------------150
01-Jan-2010 12:00:00------------15------------------------170
01-Jan-2010 15:00:00------------20------------------------170
01-Jan-2010 18:00:00------------18------------------------160
01-Jan-2010 21:00:00------------11------------------------120
02-Jan-2010 09:00:00------------20------------------------100
02-Jan-2010 12:00:00------------30------------------------190
02-Jan-2010 15:00:00------------20------------------------170
02-Jan-2010 18:00:00------------20------------------------100
02-Jan-2010 21:00:00------------10------------------------090
03-Jan-2010 09:00:00------------35------------------------200
03-Jan-2010 12:00:00------------30------------------------290
03-Jan-2010 15:00:00------------40------------------------270
03-Jan-2010 18:00:00------------45------------------------200
03-Jan-2010 21:00:00------------30------------------------290
I want a script that will pull out the daily maximum wind speed, the direction that this maximum wind speed was coming from, and the exact time that the daily maximum wind speed was recorded. Something like this -
date-------------------daily_max---direction-------time_recorded
01-Jan-2010------------20------------170--------01-Jan-2010 15:00:00
02-Jan-2010------------30------------190--------02-Jan-2010 12:00:00
03-Jan-2010------------45------------200--------03-Jan-2010 18:00:00
Any help offered would be great.
Thanks
Edited by: user10768199 on 26-Mar-2010 04:16

select trunc (dt) dt
     , max (wind_speed) keep (dense_rank first order by wind_speed desc) wind_speed
     , max (direction) keep (dense_rank first order by wind_speed desc) direction
     , max (dt) keep (dense_rank first order by wind_speed desc) date_time
  from test
group by trunc (dt)as in
SQL> with test as
  2  (
  3  select to_date ('01-Jan-2010 09:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 10 wind_speed, 150 direct
ion from dual union all
  4  select to_date ('01-Jan-2010 12:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 15 wind_speed, 170 direct
ion from dual union all
  5  select to_date ('01-Jan-2010 15:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 20 wind_speed, 170 direct
ion from dual union all
  6  select to_date ('01-Jan-2010 18:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 18 wind_speed, 160 direct
ion from dual union all
  7  select to_date ('01-Jan-2010 21:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 11 wind_speed, 120 direct
ion from dual union all
  8  select to_date ('02-Jan-2010 09:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 20 wind_speed, 100 direct
ion from dual union all
  9  select to_date ('02-Jan-2010 12:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 30 wind_speed, 190 direct
ion from dual union all
10  select to_date ('02-Jan-2010 15:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 20 wind_speed, 170 direct
ion from dual union all
11  select to_date ('02-Jan-2010 18:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 20 wind_speed, 100 direct
ion from dual union all
12  select to_date ('02-Jan-2010 21:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 10 wind_speed, 090 direct
ion from dual union all
13  select to_date ('03-Jan-2010 09:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 35 wind_speed, 200 direct
ion from dual union all
14  select to_date ('03-Jan-2010 12:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 30 wind_speed, 290 direct
ion from dual union all
15  select to_date ('03-Jan-2010 15:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 40 wind_speed, 270 direct
ion from dual union all
16  select to_date ('03-Jan-2010 18:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 45 wind_speed, 200 direct
ion from dual union all
17  select to_date ('03-Jan-2010 21:00:00', 'dd-Mon-yyyy hh24:mi:ss') dt, 30 wind_speed, 290 direct
ion from dual
18  )
19  select trunc (dt) dt
20       , max (wind_speed) keep (dense_rank first order by wind_speed desc) wind_speed
21       , max (direction) keep (dense_rank first order by wind_speed desc) direction
22       , max (dt) keep (dense_rank first order by wind_speed desc) date_time
23    from test
24   group by trunc (dt)
25  ;
DT        WIND_SPEED  DIRECTION DATE_TIME
01-JAN-10         20        170 01-JAN-10
02-JAN-10         30        190 02-JAN-10
03-JAN-10         45        200 03-JAN-10

Similar Messages

  • Urgent! Display lookup value and return value at the same time.

    We are using pop up lov.
    How can we display lookup value and return value at the same time. let me claer..
    Our lov query is like fallowing
    select dname, deptno from dept
    we want to return deptno column into a database bind text item and dname column into a display item (look up)
    can we do it (we need to do)
    thanks for your help.

    We did it .
    But pop up key lov (display description return value ) property doesn't appear for tabular forms item.
    (Report Attributes pages Tabular Form Element section display As property list)
    can we set or not.
    Thank you.

  • Sampling waveform values and writing corresponding time values

    I am sampling the frequency of a generator set using a 1126 module. The frequency values I am getting are approximately 60 Hz.
    I am sampling at 150 samples per second and using the Index Waveform Array function to peel off the frequency waveform. Then I am running that waveform wire (brown) through a Get Waveform components function to seperate the t0, dt, and y components. I am taking the oranage wire from the Y portion to write those values to a spreadsheet file. Then I want to build an array of the frequency values and the time values and write that to file (transposing the array if need be).
    I want one column to be the frequency values and the second column to be the correspond
    ing time values for each of those data points. For example, starting at t=0:
    Frequency (Hz) Time (s)
    60.0 0
    60.1 0.0066666
    59.9 0.0133333
    60.2 0.0200000
    60.1 0.0266666
    |
    |
    | end of first second
    |
    V
    60.5 0.9866666
    60.1 0.9933333
    60.0 1.0000000
    59.7 1.0066666
    The time interval increments by 1/150 of a second each time a sample is taken (150 times per second).
    I tried to use the Get Waveform Time Array function, but that returned a 10 digit number that did not appear to be related to the time in seconds.
    Can someone please advise me on how I can get the corresponding time values in seconds for waveform data points in the situation described above? Thanks!

    Since you are aquiring at a constant sample time, you could try using the ramp pattern to generate the time column.
    I attach a sample VI in which I generate the ramp starting from waveform characteristics and then create the 2d array to save to disk with Write to Spreadsheet File.vi.
    Hope this helps
    Roberto
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?
    Attachments:
    waveform_to_spreadsheet.vi ‏20 KB

  • Comparisons of Duration, Date and Time Values

    Hello,
    Is there way to simulate support for XPath 2.0 date/time comparison functions?
    (can I create a module to replace currently available XPath functions with my
    own?)
    Are there plans to fully support those functions?
    For example: func-date-less-than
    http://www.w3.org/TR/xquery-operators/#func-date-less-than
    ... snip ...
    ( time-less-than( time("12:00:00"), time("23:00:00+06:00") ) )
    ... snip ...
    Regards,
    Benjamin Shrom.

    Just use lt on the dates, dateTime and time elements
    <db>
         for $PB_BB.CUSTOMER_1 in document("PB-BB")/db/CUSTOMER
         where ($PB_BB.CUSTOMER_1/CUSTOMER_SINCE lt $#customer_since_cutoff of type
    xs:date)
         return
         <CUSTOMER>
              <CUSTOMER_ID>{ xf:data($PB_BB.CUSTOMER_1/CUSTOMER_ID) }</CUSTOMER_ID>
         </CUSTOMER>
    </db>
    - Mike
    "Benjamin Shrom" <[email protected]> wrote:
    >
    Hello,
    Is there way to simulate support for XPath 2.0 date/time comparison functions?
    (can I create a module to replace currently available XPath functions
    with my
    own?)
    Are there plans to fully support those functions?
    For example: func-date-less-than
    http://www.w3.org/TR/xquery-operators/#func-date-less-than
    ... snip ...
    ( time-less-than( time("12:00:00"), time("23:00:00+06:00") ) )
    ... snip ...
    Regards,
    Benjamin Shrom.

  • "RT Set date and time" does not set seconds in UTC mode

    Hallo,
    I tried to set the time on my cRio 9012 with the function settimeUTC which is used by the "Set Date and Time" vi. But the seconds I enter are ADDED to the current time and not set as new value.
    Even the vi shows this behaviour: I set up a vi in which the time is set in a loop (100ms delay) and read again. When I set local time the clock stops (as expected) but when I set the UTC time the seconds keep on running...
    Can anybody help me with that problem???
    Thanks
    Florian
    Solved!
    Go to Solution.

    Hi Andreas,
    well it does not matter if I set a time zone in the MAX or not. In my example I was working on UTC + 0 but even when I set it to my local time (UTC + 1) I get the same behaviour modified by one hour.
    My LabView Version is 8.5. In in the MAX under Software-> LabView-RealTime it says that I am using 8.5.0.
    I suspect  that the settime.out which is installed on the cRio is probably the root of the problem as VxWorks itself does not offer a function (at least I did not find one) to convert from broken down system time to system time in seconds. There only exist one to convert from broken down local time to system time in seconds ( mktime() ). The reverse function is available for both cases: gmtime() and localtime(). I also did not find a way to find out the offset of the local time. So I have to use the library function settimeUTC() from settime.out.
    As I offered I can send you the settime.out file from my cRio for reference or maybe you can tell me how to find out what the version of the file is. It seems not to be an ELF file as I looked inside it to find some timestamp or version info...
    Thanks so far 
    Florian

  • Retriving records with the date and time stamp

    I need to get all the records that were update between 08:36:06 AM and 8:36:09 AM on the12/15/2009
    I am using this query it is giving me the right numbers (I think) because this condition GURMAIL_CPLN_CODE = 'UGAP', I would like something more
    precise using the date and time stamp with the dates
    12/15/2009 08:36:06 AM
    12/15/2009 08:36:07 AM
    12/15/2009 08:36:08 AM
    12/15/2009 08:36:09 AM
    select * from GURMAIL
    where
    PERMAIL_CPLN_CODE = 'UGAP'
    AND TO_CHAR(PERMAIL_ACTIVITY_DATE,'MM/DD/YYYYHH24:MI:SS AM') >= '12/15/2009 08:36%'Thank you

    Yes, but HH24 and AM cannot be used together:
    SQL> select to_date('12/15/2009 08:36:06 am', 'mm/dd/yyyy hh24:mi:ss am') from dual;
    select to_date('12/15/2009 08:36:06 am', 'mm/dd/yyyy hh24:mi:ss am') from dual
    ERRORE alla riga 1:
    ORA-01818: 'HH24' impedisce l'uso dell'indicatore meridianoUse this:
    select *
    from   gurmail
    where  permail_cpln_code = 'UGAP'
    AND    permail_activity_date between to_date('12/15/2009 08:36:06', 'mm/dd/yyyy hh24:mi:ss')
                                    and  to_date('12/15/2009 08:36:09', 'mm/dd/yyyy hh24:mi:ss')or this:
    select *
    from   gurmail
    where  permail_cpln_code = 'UGAP'
    AND    permail_activity_date between to_date('12/15/2009 08:36:06 AM', 'mm/dd/yyyy hh:mi:ss am')
                                    and  to_date('12/15/2009 08:36:09 AM', 'mm/dd/yyyy hh:mi:ss am')Max
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2009/12/18/table-elimination-oppure-join-elimination-lottimizzatore-si-libera-della-zavorra/]
    Edited by: Massimo Ruocchio on Dec 23, 2009 12:05 AM

  • Next Syndication Date and Time changing

    Hi Experts,
    While setting the Outbound port to Automatic with Daily processing interval i set Next Syndication Date and Time to some value.
    but after the first occurrence of syndication, Next Syndication Date and Next Syndication Time are changing to new unexpected value.
    I am using MDM 5.5 SP6 version.
    Please help on this.

    Hi Prashant
    Copying from the SAP Note 1124246-
    Bug Fixes
    MDM SYNDICATION SERVER 5.5
    Fixed: Change for auto syndication to update next syndication time without accumulating time offsets
    Please close the thread if answered.
    Thanks-Ravi

  • Last execution date and time of a transaction

    Hi,
    Could anyone let me know the procedure to find the last execution date and time of a transaction (for example MM01/MM02). We are currently working on ECC6.0
    Raja

    Hi Raja,
    Check table CDHDR, fetch data against T code MM01/MM02 and get MAX(UDATE) and MAX(UTIME).
    You will get last execution date and time.
    Please reqward ponits if it useful.
    Regards
    Krish

  • SCCM 2012 R2 changing date and time for patching software update groups

    I recieve this error when changing date and time for software update group. worked fine yesterday before patches to the server were applied last night. we removed patches but still get error below. Any help would be great.
    ConfigMgr Error Object:
    instance of SMS_ExtendedStatus
    Description = "Property array AssignedCIs exceeded the max allowed";
    ErrorCode = 1078462259;
    File = "e:\\nts_sccm_release\\sms\\siteserver\\sdk_provider\\smsprov\\sspupdatesassignment.cpp";
    Line = 94;
    Operation = "PutInstance";
    ParameterInfo = "";
    ProviderName = "ExtnProv";
    StatusCode = 2147749889;
    Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlQueryException
    The SMS Provider reported an error.
    Stack Trace:
    at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject.Put(ReportProgress progressReport)
    at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject.Put()
    at Microsoft.ConfigurationManagement.AdminConsole.SmsDialogData.Put(IResultObject resultObject, List`1 resultObjectsPut, Boolean retainLock)
    at Microsoft.ConfigurationManagement.AdminConsole.SmsDialogData.Put(Boolean retainLock)
    at Microsoft.ConfigurationManagement.AdminConsole.DialogFramework.Forms.SmsPropertySheet.Put(ActionTrigger trigger)
    System.Management.ManagementException
    Generic failure
    Stack Trace:
    at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject.Put(ReportProgress progressReport)
    at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject.Put()
    at Microsoft.ConfigurationManagement.AdminConsole.SmsDialogData.Put(IResultObject resultObject, List`1 resultObjectsPut, Boolean retainLock)
    at Microsoft.ConfigurationManagement.AdminConsole.SmsDialogData.Put(Boolean retainLock)
    at Microsoft.ConfigurationManagement.AdminConsole.DialogFramework.Forms.SmsPropertySheet.Put(ActionTrigger trigger

    no it is the final version... is working today after cleaning up database... is working now...thanks
    Hello Robert,
    would you please give some more informations, as I have the same issue and don't get what you mean bye "cleaning up databases".
    Regards ooGDoo
    ooGDoo

  • Package, unit and time dimensions

    Hi. I understand that a star schema can have max of 16 dimensions out of which 13 can be defined. what are other three package, unit and time dimensions?are they used in all cubes? are they defined by SAP system itself?
    please help
    rajesh

    Hi Rajesh,
    We have to consider two things while u r creating the cube... Try to decrease the no of dimensions and also the No of reocrds in the dimension....
    Well we go for deciding which char has to assign to which dimension depending on one rule...
    Stronger entities will come into different dimensions and the weeker entities will come into same dimensions.......In other words One to one and one to many relationship will come into same dimension and may to many ioto differetn dimensions....
    Assign points if it helps
    Khaja

  • MyRio Cannot Communicat​e When the Getting Started Wizard Tries to Set Date and Time

    I cannot seem to get MyRio to communicate with my computer. I have installed all the items on both discs and applied any updates that it asked me to do. I plug in the MyRio, the device window pops up and I click the Getting Started Wizard. The myRio is found by the computer and I click on it. It says checking software, then asks me to rename it. I do so and then it attempts to set the date and time. At this point it says it cannot communicate with the myRio and to check that the power supply and USB are plugged in, which are obviously connected since the computer was able to find the myRio in the first place.
    NI MAX can see the myRio, says that it is in "Safe Mode (Software not installed)."
    There may be a problem with conflicting LabViews, since I had 2012 originally before installing the 2014 packages. Does anyone know if the myRio discs are installing the full LabView 2014, or just packages for LabView 2014 that will not work without first installing the full LabView 2014? Or is there a quick fix for this?
    Any help is appreciated.

    There is a separate message board Academic Hardware Products (ELVIS, myDAQ, myRIO)

  • Invalid text value. A text field contains invalid data. Check the value and try again

    Hello,
    I am having a problem with the error mentioned in the title. I see alot of others have experienced the same problem, but I have quite a twist to it.
    I see the problem when I try to edit a list item, and then try to save the changes.
    Here what I see in the ULS log:
    System.Runtime.InteropServices.COMException: Invalid text value. A text field contains invalid data. Check the value and try again  
    at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId,
    Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter
    pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)   
    at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean
    bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback,
    ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
    I have 3 front end servers(fx wfe1, wfe2, wfe3).  And here is the twist.
    If I access the library directly through wfe1 and wfe2, I get the error. If I access the library via wfe3 if works just fine.
    So because of this, I think it is safe to assume that is has nothing to do with the character limit of 255. Nor does it have anything to do with the field type, since it is already set to mulitible lines of text.
    So. Any ideas?
    Regards,
    Michael
    mic

    Check if there is any change in web.config of these servers
    http://support.microsoft.com/kb/2880758
    To work around this issue, limit the length of the personal message in the invitation to 256 characters or less.
    This is a known issue. Microsoft is working to resolve this issue.
    http://social.msdn.microsoft.com/Forums/en-US/7bb16e51-e7cc-439e-a8b3-755683ccac1a/max-length-on-custom-field-types
    To solve the problem you may have to change the field's parent type to "note". To do that you have to open your fldtypes... file under Templates/xml and change the line to:
    "<Field Name="ParentType">Note</Field>" from "<Field Name="ParentType">Text</Field>"
    You might also have to add a sql type if your text needs to be longer than 255 characters
    <Field Name=”SQLType”>ntext</Field>
    and inherit from SPFieldMultiLineText instead of SPFieldText
    If this helped you resolve your issue, please mark it Answered

  • Project Planning and time scheduling

    Hi Experts,
    Can you please tell me the basic major consideration involved in doing the Project Planning and time Scheduling...
    Thanks
    -Sid
    "Max Points On  Most Accurate Answers"

    HI Sid,
    Look at the below links
    http://www6.sap.com/businessmaps/2583AC927FFD42CD8744082FA42228E6.htm
    http://help.sap.com/saphelp_ppm400/helpdata/en/02/4b1a417c4bf423e10000000a155106/content.htm
    Regards
    Sudheer

  • Lat job rundate and time

    Hi All,
    I want to get the last job run date and time from TBTCO Table . My program will schedule for every 30 mins.
    I have to get the Last job run date and time from TBTCO table. Is there any function module to get the last job run date and time from TBTCo table.
    I have used the below code.
    SELECT * from tbtco into table t_tbtco where jobname = 'ZWELOMDM_KEY_TABLE_LOAD' and status <> 'A'.
        if sy-subrc = 0.
          SOrt t_tbtco by strtdate strttime Ascending .
          read table t_tbtco  index  '1'.
    but sometimes its not woking .
    Does Select with Max will work for this.
    Thanks,
    Madhu

    Try function modules from XBP interface. They are called BAPI_XBP_\*. There are also the old but documented BP_\* function modules (http://help.sap.com/saphelp_nw2004s/helpdata/en/fa/096c53543b11d1898e0000e8322d00/frameset.htm).

  • Value and quantity is not displaying in Tcode MC.9 for some materials

    Dear Sir,
          For the material XYZ Material Type is FERT but when I check the stock in MC.9 with material type FERT, it is not displaying any value and quantity but when I donu2019t put any Material Type it is showing me the value with quantity. Even I tried to change the material type to FERT there also it gave me message as "No data exists for chosen selection". Why this massage is showing like this ?
    Please suggest.
    Regards,
    Sandip Sahu

    Hi,
    Some times there are some issues with S032 info structure. Check report RMCBMBEW and see if you can locate your material,
    Thanks

Maybe you are looking for