Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
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.
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 questionAsk a Question
731 491 924 answers to any question