My table takes a timestamp whenever the user status changes. Every day it begins at "a" and always progresses a->b->c->d->e->...
So I'm trying to find the total time between 'a' and 'b' plus the time betwen 'c' and 'd' plus 'e' and 'f' and so on.
This works to get the time between two of statuses:
SELECT cast(us2.status_timestamp as date) - cast(us1.status_timestamp as date)
FROM user_status US1, user_status US2
WHERE US1.statID = 'a' and us2.statID = 'b'
AND US1.user_ID = US2.user_ID
AND US1.work_date = US2.work_date
Is there a way to do this without just doing this select statement multiple times, then adding the results? I feel that there is a faster way.
Note: using Toad for Oracle