Y
Y
Yeaap2014-08-19 11:35:32
PHP
Yeaap, 2014-08-19 11:35:32

Oracle how to find total time for device by primary key, knowing start date and end date ?

Oracle how to find total time for device by primary key, knowing start date and end date ?
e13034ad0e6d424ba7869a331c314f0a.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Lebedev, 2014-08-19
@swanrnd

You can add another column with duration.
Selecting by calculated columns is very slow. You can do it a couple of times, but regularly it's not right.

A
Alexey Skahin, 2014-08-20
@pihel

Why not write like this:

SELECT SUM( t.ts_inserted - t.ts_cleared ) secs
FROM table t
WHERE t.device_id = ?
AND ? BETWEEN t.ts_cleared AND t.ts_inserted

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question