Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Get the records which are older than 1 hour and which does not have record for last 1 hour

user12251389Feb 3 2017 — edited Feb 6 2017

I want to get the records which are older than 1 hour and which are not duplicated. Below is my table structure for KPI_LOGS table. I want to get the KPI_DEF_ID for which the timestamp is older than 1 hour and also this KPI_DEF_ID does not have any record from last 1 hour. For example if i take KPI_DEF_ID = 1000570 and check in KPI_LOGS table then i will also get the newer records for 1 hour and i dont want such KPI_DEF_ID if i query for older than 1 hour

pastedImage_0.png

I tried below query but it gives all the record which are older than 1 hour but i dont know how to write second condition where the KPI_DEF_ID which i will get for older than 1 hour should not be in present in the newer records

SELECT * FROM KPI_LOGS WHERE TIMESTAMP < SYSDATE - 5/24

This post has been answered by RogerT on Feb 3 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2017
Added on Feb 3 2017
8 comments
20,373 views