Reputation: 101
I want to calculate total difference between two date fields in SQLite (they are declared as REAL). I.E. datefield1 and datefield2 and group by day.
Datefield1 is login date, datefield2 is logout date. Each day, user can login/logout several times. I want to sum up login time of a user (datefield2-datefield1) for each day.
Upvotes: 1
Views: 1210
Reputation: 101
SOLVED:
Query
select id, datetime(logindate), datetime(logoutdate),
sum((julianday(logoutdate) - julianday(logindate)))
from MyTable GROUP BY strftime('%d', logindate);
Upvotes: 1