Okay, so I need to execute a bit of a nasty MySQL query, and I can't think about how to do this in my life.
I have the following content:
id date name join_or_leave 1 yyyy-mm-dd hh-mm-ss user1 join 2 yyyy-mm-dd hh-mm-ss user2 join 3 yyyy-mm-dd hh-mm-ss user1 leave 4 yyyy-mm-dd hh-mm-ss user3 join 5 yyyy-mm-dd hh-mm-ss user2 leave 6 yyyy-mm-dd hh-mm-ss user1 join 7 yyyy-mm-dd hh-mm-ss user4 join 8 yyyy-mm-dd hh-mm-ss user1 leave
In this way, it logs all login / logout times for users.
What I have to calculate is the total time spent on the Internet (the total number for all users, but I can work out this amount after receiving the total amount for each user, if the total number of all users is very slow).
Hope this is obvious what I need to do here, it is obvious that all dates go down (so that regardless of the time you add the join / exit record); but how would I do it, I just donβt know .: P
sql mysql datetime logging sum
Simo389
source share