Report the latest  event (record) for a device

I could have sworn I had this one working before but for the life of me I cant remember how I did it and I cant seem to figure it out anew.
I'm tracking events per device. A device may have any number of events in a given time period. I need to track the MOST RECENT event for a device per device. I do not want to have multiple records per device, only the record with the MOST RECENT timestamp.
I made the following two attempts but I'm still getting nowhere.
select
  device,
  MAX(dt) KEEP (DENSE_RANK FIRST ORDER BY dt) as time_Var
from db_table partition (pPname)
where
    Lower(example) like '%example text%'
    and dt > sysdate - 5and
select DISTINCT
device,
       (select TO_CHAR( (MAX(table_name.dt)), 'HH24:MI:SS MM/DD/YYYY') "timeVar"
          from table_name partition (pPName)
          where
       Lower(Example) like '%example text%'
       and dt > sysdate - 5)
from table_name partition (pPName)
where
    Lower(Example) like '%example text%'
    and dt > sysdate - 5
order by device Asc;

Hi,
Salim's solution with
KEEP (DENSE_RANK FIRST ORDER BY dt)will show you the least recent event in the last 5 days.
If you want the most recent event, change "FIRST" to "LAST"
KEEP (DENSE_RANK LAST ORDER BY dt)or sort in DESCending order:
KEEP (DENSE_RANK FIRST ORDER BY dt DESC)If you want to display several columns from the most recent row, you'll have to use KEEP (DENSE_RANK ...) on each of them (except device).
In that case, you might find it easier to use an analytic function, such as ROW_NUMBER:
WITH     ranked_data  AS
     SELECT     device, column_a, column_b, column_c
     ,     ROW_NUMBER () OVER ( PARTITION BY  device
                               ORDER BY          dt     DESC
                       )  AS r_num
     FROM     your_table
     WHERE     LOWER (example)      LIKE '%example text%'
     AND     dt               > SYSDATE - 5
SELECT  device, column_a, column_b, column_c
FROM     ranked_data
WHERE     r_num   = 1;

Similar Messages

  • "SOME" devices can resolve the ALIAS (CNAME record) for a device, but not the REAL name (A record) - Why? How do I fix this?

    I'm running the DNS server role on Windows Server 2012 R2 on a physical machine on my home network.
    My AD is configured with a non-registered name - let's say it's "home.acme.ca" and the DNS server is configured to host that zone.  I also configured a 2nd zone in the DNS server called "myinf.acme.ca".  They both run on a physical
    server with an IP of 192.168.1.10
    The DHCP server on my Cable Modem is configured to hand out 192.168.1.10 as the only DNS server to every device on my network.  On my servers (with static IP addresses), 192.168.1.10 is configured as the only DNS server available for them. 
    I took the DNS servers from my Cable Provider and configured a Forwarder on my server to send name resolution requests to them only if my DNS server can not answer the request - basically for any name resolution request that does not end with ".home.acme.ca"
    or ".myinf.acme.ca"
    The "home.acme.ca" zone is populated with 'A' records for all of the physical and virtual servers and PC's on my network.
    The "myfin.acme.ca" zone is populated with 'CNAME' records that point directly to the 'A' record in "home.acme.ca" - for example, I have a serve named s000abc123ww.home.acme.ca with an 'A' record providing an IP address of 192.168.1.20 and
    I created a 'CNAME' (alias) record named 'webserver.myinf.acme.ca' which points to the 'A' record 's000abc123ww.home.acme.ca'
    2 of my 6 machines can resolve the alias but not the real name of the server!
    .10 is the Domain Controller.  All of the other machines (except .98) are members of the home.acme.ca domain.
    I attempted to ping 's000abc123ww.home.acme.ca' AND 'webserver.myinf.acme.ca' on the following 6 computers.  I used the fully qualified name in all cases.
    4 of the below machines are able to resolve BOTH names.  The other 2 can resolve the Alias but not the real name!
    I don't understand how this is possible, but I would like to fix it...!!!  Please help?
    .10 - Server 2012 R2 (Physical) -  Hosts Active Directory and DNS.
    .20 - Server 2012 R2 (Virtual)   -  Runs SQL Server
    .21 - Server 2012 R2 (Virtual)   -  Runs Apache
    .22 - Server 2012 R2 (Virtual)  -   Runs Apache.  This is the device I am trying to ping (s000abc123ww)
    .98 - Windows 7 (Physical)
    .99 - Windows 7  (Virtual)
    .21 (which is configured nearly identically to .20 and .22) can resolve and ping the Alias, but not the real name.
    .98 can also resolve and ping the Alias, but not the real name.
    The rest of the machines can resolve and ping both the alias and the real name.
    All of the Virtual Machines are running under Hyper-V on the .10 physical server.
    All the devices are on the same subnet.
    Thank in advance to anyone who can help me understand and correct this problem!
    Jim

    Hi,
    CNAME resource records are recommended for use in the following scenarios:
    • When a host that is specified in an A resource record in the
    same zone needs to be renamed
    • When a generic name for a well-known server, such as www, must resolve to a group of individual computers (each with individual A resource records) that provide the same
    service, for example, a group of redundant Web servers
    Therefore please try to create your CNNAM record in the same zone and try again.
    The related KB:
    Adding, Changing, and Deleting Resource Records
    http://technet.microsoft.com/en-us/library/cc779020(v=ws.10).aspx
    Hope this helps.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Making system to use the latest Infotype Record for the Current Period

    Hello,
    I would like to know how the system behave if there is a record modified in the middle of the Pay Period, which record would the PY schema use? Ex: in IT0009 EE has selected multiple Bank Transfer. He say 100$ Bank 1 and Rest to Bank 2. In the middle if the Pay period, the EE comes and makes changes to his Bank Transfer, as he closed the account in Bank1, he creates new Bank and transfers 100$. Now when the PY run, it think both Banks (Bank1 prev and Bank 1 current ) are valid and tries to send 100$ to each back and sends rest to Bank2. Which is not correct. This issue happens when someone changes their record in the middle of the period. So It is assumed to change the process to not to change in the middle of the period. It has to be effecting of 1st of next period.
    But I want to check is there anyway we can make the system to use the latest one if it finds multiple record for the same period?
    any suggestion please.
    Thank you.
    Raj

    Hi Donnie,
    This system actually delimits the previous record but since the change is happened in the middle of the period, but record are considered as active.
    For Ex: The Pay Period is 01/01/2009 to 01/15/2009 and There was a record for Bank1 for that period and user comes and creates a new record on 01/05/2009 for Bank1. Now for this payperiod since its with the period both records are becoming active. So system uses both the records and deducts. Hope you get what I'm saying.
    Thanks,
    Raj

  • My HP scanner/printer scans but my iMac doesn't seem to accept the scans in either iPhoto or Pictures.  I've got os 10.6.8 and all the latest sofware updates for the scanner and for iPhoto.  Helpv

    My Hp printer/scanner C5280 used to work fine with my iMac with OS 10.6 but lately after doing the scan it doesn't seem to finish by putting the scan in either iPhoto or in pictures.  I have all the latest sofware updates for both devices. The scanner does the "preview" scan right away and the copier works fine.  Is there some setting I am overlooking?

    Try using Image Capture, you will find it in your Applications folder. In either IC or the method you are using you can tell the application to scan to a destination. It will look similar to:
    If you still have trouble give AppleCare a call or visit your local Apple Store Genius and they can walk you through it. Your problem may be the at you are not defining anything in the preview to be scanned, you do this by dragging the mouse over the area you want scanned and it will draw a box around it.  Here is a screen shot that show's that.

  • HT4740 i already did the Hidding part and later moved the events and projects to the FCP events and projects folder . I still cannot share - keep getting this message "THE SHARE OPERATION 1080P FOR APPLE DEVICES (10 MBPS) HAS FAILED. Quicktime Error -50

    i already did the Hidding part and later moved the events and projects to the FCP events and projects folder . I still cannot share - keep getting this message "THE SHARE OPERATION 1080P FOR APPLE DEVICES (10 MBPS) HAS FAILED. Quicktime Error -50
    I dont know what else to do to be able to share my project - I know i updated FCPX before i shared this project  but i dont know what im doing wrong

    masterpieces wrote:
    later moved the events and projects to the FCP events and projects folder .
    Can you explain in detail what you did?
    Do any other shsre destinations complete? If not, do you get the same error message?

  • What is the latest kernel number for CPU July 2013

    Hi All,
    have any one patch CPU July 2013 already?
    I want to know what is the latest kernel number after you applied the CPU July 2013 reported by uname -a?
    is it  148888-03?
    Thanks

        Hi LCromwell, I can help you with the most updated software for your Blackberry 9850. I understand what it means to have the most update software so your phone can function the best possible. I show the most updated software for your device is 7.1.0.163 . Here is a link for information and steps for updating the software on your device http://bit.ly/OCOllA . I hope this information was helpful. ^KH

  • Get the latest date record in Query

    Hi, Expert:
    Please help on this:
    The requirement is to get the the latest date record in Query. For example:
    Data in provider:
    Plant          date            amount
    A01         2007/04/08      30
    A01         2007/06/09      70
    A01         2007/12/08      30
    we only want the query display:
    A01         2007/12/08      30
    I have tried exception aggregation, but it does not work. Any ideas are highly appreciated.

    Or you can model the date as a key figure after 0date_kyf and set aggregation to max, you'll get something like
    select plant, amount, max(date) from ... group by plant, amount
    used it for inventory reporting (materials and their last movement date, days from the last movement etc.) and worked well.

  • Mac OSX SUS - Why aren't the latest updates offered for some software

    For instance, on my sus, Quicktime 7.6.4 is the latest version offered for leopard. 7.6.6 is available on Apple's site. Is there actually a 7.6.6 update others can see on their sus, or is this a universal issue - and why aren't the latest updates available?
    Thanks

    I just checked my 10.6.3 SUS server at it appears to have that Quicktime 7.6.6 update listed. The size is listed as 68.5 MB and the post date is 03/30/10. My SUS Server Admin interface shows a "Last Check" time of Apr 13, 2010 3:00:00 AM.
    I have wiped and reinstalled my SUS server several times dealing with the "missing 10.6.3" updates bug reported many times in these forums so that may be why my server is displaying the Quicktime 7.6.6 update.

  • How to exctract/backup a client certificate from Firefox for Android similar to question #1000240 but for the latest Firefox Beta for Android?

    As in #1000240 and in #1032181, I've installed a StartSSL login certificate in my Firefox for Android and having a problem with extracting/backuping it to use with another device/browser.
    I'm using the latest Firefox Beta for Android (35.0) at present; the Android version is 4.1.2, my phone model is Sony LT26i (Xperia S), so neither of the aforementioned questions asked at the Mozilla Support website do not contain any solution to the given problem.
    Any chance to recover the certificate?
    P. S. I haven't rooted my device; if getting a root is the only possible way to recover the certificate, I may consider doing so.

    You can try https://addons.mozilla.org/en-US/android/addon/copy-profile/ If that does not retrieve the file then see below.
    If you know the name and path of the file you can get it using run-as function of adb. See http://stackoverflow.com/questions/18471780/android-adb-retrieve-database-using-run-as
    If you end up down here you'll need root to be able to navigate the file system. I don't know the file name, though it is likely in your profile folder which can be determined by visiting about:cache in the Firefox address bar. It will be similar to /data/data/org.mozilla.firefox_beta/files/mozilla/$RANDOM.default/

  • Need help on how to identify the latest timestamp ran for the WorkBooks

    I know some tables to identify the workbooks when they are created.But this tables are not updating If we ran the workbook today.
    for example, :   if we created workbook & saved on 05/25/2009 or opening old WB.After that if we ran same workbook on 05/26/2009 then system has to update the latest timestamp as last ran.but iam unable to find this timestamps for workbooks.
    WB are maitained in RSDDSTAT.here i can able to find when it was last changed but not the latest timestamps.Our requirement to find the latest timestamp ran for the WorkBooks from last one year, which are using.
    below are the tables to identify when the workbook was created and other details:
    RSRWBINDEX  List of binary large objects (Excel workbooks)
    RSRWBINDEXT  Titles of binary objects (Excel workbooks)
    RSRWBSTORE  Storage for binary large objects (Excel workbooks)
    RSRWBTEMPLATE  Assignment of Excel workbooks as personal templates
    RSRWORKBOOK  Where-used list for reports in workbooks
    Thanks in advance
    Mahesh

    Any Updates,
    I got one more table to identify WB,
    /BI0/PTCTWORKBK - Master Data (Time-Ind.): Characteristic Workbook
    Still unable to find Last run timestamps for workbooks
    Mahesh.

  • What is the latest software version for the Nokia ...

    So this is really just a token post to keep my service provider happy (no idea why I have to do all the asking for them when we both already know the answer) but can I please have a confirmation of the latest software versoin for the Nokia 6700 Slide.
    On a side note it would be greatly appreciated if you could PLEASE send a copy of the latest version of the software to my carrier (Vodafone Australia) so that they can finally push out the latest version of the software.
    Thanks, swinsor

    v71.004 seems to be the last released update. If the phone is Network branded your device may / may not get this update. Anyway, the update was released long ago. 
    This being a User-to-User Forum, can't do anything else than providing the info. 

  • Query to find the latest two transactions for each Group

    Hi All,
    Consider the following sets of records in a table test.
    Group---Tran_Dt---SlNo
    c1 10/10/2003 1
    c1 10/10/2003 2
    c1 10/10/2003 3
    c1 11/10/2003 1
    c2 10/10/2003 1
    c2 10/10/2003 2
    c2 11/10/2003 1
    c2 11/10/2003 2
    c2 11/10/2003 3
    c3 10/10/2003 1
    c3 10/10/2003 2
    c3 10/10/2003 3
    I want to list out the latest two transactions for each group irrespective of the slno and trans_dt as below:
    group tran_dt SlNo
    c1 11/10/2003 1
    c1 10/10/2003 3
    c2 11/10/2003 3
    c2 11/10/2003 2
    c3 10/10/2003 3
    c3 10/10/2003 2
    Any help on this would be appreciated.
    Thanks
    Walter Nicholas T

    Hi Walter,
    Please try following query.
    select Group,tran_dt,sino from
    select Group,tran_dt,sino,(DENSE_RANK()OVER (PARTITION BY Group ORDER BY tran_dt desc,sino desc)) rank from test
    ) where rank between 1 and 2
    Thanks,
    Samir

  • Is there any way to disable face recognition in the latest Yosemite update for Photos?

    Is there any way to disable face recognition in the latest Yosemite update for Photos?

    Ingenico has a 1D Bluetooth barcode scanner certified MFi by Apple.
    http://baracoda.ingenico.com/Baracoda-i-fly.aspx
    Baracoda i-Fly is compatible with Apple iPod touch, iPhone and iPad.
    Baracoda i-Fly supports IAP Bluetooth profile and is MFi certified, which means it is 100% compatible with Apple development standards and performances.
    Its Bluetooth connection is bidirectional, which enables the i-Fly to transmit data both ways in mode « No Data Loss »).
    Furthermore, Firmware update is also possible, which is not the case for non-MFi certified devices.

  • What is the latest OS number for the 9850?

    What is the latest OS number for the 9850? Either released by VZW or not? I'm currently running 7.1.0.163  looking for an update.

        Hi LCromwell, I can help you with the most updated software for your Blackberry 9850. I understand what it means to have the most update software so your phone can function the best possible. I show the most updated software for your device is 7.1.0.163 . Here is a link for information and steps for updating the software on your device http://bit.ly/OCOllA . I hope this information was helpful. ^KH

  • CUCM 9.1 Call Recording for analogue devices

    Hi,
    We are designing a CUCM 9.1 solution where Active Call Recording for analogue devices feature is required.
    http://www.cisco.com/en/US/docs/voice_ip_comm/cucm/admin/9_0_1/ccmfeat/CUCM_BK_CEF0C471_00_cucm-features-and-services-guide_chapter_0100110.html
    According the feautre list support it seems that is supported by the old ata 186 but not by the ata 187.
    Then, how could we achieve this on a new deployment? Has anyone had the chance to deal with this?
    Many thanks in advance. Thank you very much,
    Francesc

    This is a weak spot in the native Cisco solution portfolio. I'll try to give one option but hopefully others will chime in with something more clever.
    The MediaSense product can record trunk-side from Cisco CUBE which allows for device-agnostic recording; however, that only works if you're not concerned about internal calls to/from the analog phones (i.e. just to/from the PSTN). Getting the last part seems to require old fashioned SPAN recording to a capture server of a third party. This can get dicey though because most of the third-party recording vendors manually decipher the SCCP packets to figure out the calling/called party information. Be sure to ask them whether SCCP- or MGCP-controlled gateways are supported.
    Please remember to rate helpful responses and identify helpful or correct answers.

Maybe you are looking for

  • Lenovo G560 doesn't memory upgrade probelm

    I'm having trouble with upgrading memory in my G560.The current configuraion has a DDR3 1333Mhz module. I'm trying to add a new 4GB DDR3L 1600Mhz SO-DIMM module Transcend make. The BIOS recognizes the 6MB memory, but while booting my windows7 home 64

  • EW ERROR: "I won't open a connection to 127.0.0.1 (only to ...) (500)

    I wonder if anyone here can offer some advice. I've been using EW 4 for a couple of years to create and modify my business's website. Maybe six months ago, I started get the error message in this post's title whenever I try to publish changed pages t

  • How do I transfer pictures and videos on to computer

    Have all on Micro SD card, but computer won't read it. Used card reader as well as other computers, didn't work.

  • [HELP] Advanced Video FX bug?

    Hi guys. Hope someone can help me. I have he creative Webcam Live! with latest drivers installed.Now i've downloaded the "Advanced Video FX" software.But when i clink on it, i cant select my webcam. Actually, it shows NO webcams to select.Can anybody

  • Cant see iphone music when connected to itunes.

    There is music stored on my phone and I would like to change it. Usually I can do this by connecting it to ituens and deleting it all and then refilling it. Now it is showing in iTunes as having no music even though there is and it can be played from