• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

Help with query for entries that take over 4 mins for the current day.

Gurus,

I need help writing a query that reports all entries that take over 4 mins for the current day.

Current Query:

select tsjkeyi import_id, TSJSTAD start_time, TSJENDD end_time from TSJ
where TSJTYPS = 22
order by TSJSTAD desc;

Result:
import_id   start_time                                               end_time
379324         02-SEP-14 08.25.09.663000000 AM         02-SEP-14 08.31.11.118000000 AM
379316         02-SEP-14 08.23.48.561000000 AM         02-SEP-14 08.23.50.418000000 AM

I just want the record where the total time was over 4 minutes:

import_id   start_time                                               end_time
379324         02-SEP-14 08.25.09.663000000 AM         02-SEP-14 08.31.11.118000000 AM

Thanks in advance!
0
xbox360dp
Asked:
xbox360dp
1 Solution
 
sdstuberCommented:
SELECT tsjkeyi import_id, tsjstad start_time, tsjendd end_time
    FROM tsj
   WHERE tsjtyps = 22 AND tsjendd - tsjstad > INTERVAL '4' MINUTE
ORDER BY tsjstad DESC;


this assumes your tsjendd and tsjstad columns are both of type timestamp.
0
 
xbox360dpAuthor Commented:
Perfect!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now