Been racking my brain for weeks on how I could correctly achieve this, been playing around with PHP & mySQL but every formula or function I write seems to be missing something. Here's exactly what I'm trying to do..
-mySQL database filled with records of logins.
-Fields are RECORD,START_TIME,DURATION,CUSTOMERID
-RECORD is unique key
-START_TIME is in the "2013-12-12 10:32:59" type format
-DURATION is in seconds
-CUSTOMERID is the unique account number of user
Each user is allowed 3 simultaneous logins, any logins above 3 at a time I need to tally up a total of seconds of DURATION for that user of all sessions during the "overage".
So an example would be..
RECORD | START_TIME | DURATION | CUSTOMERID
1 2013-1-1 12:00:00 10 BILLYBOB
2 2013-1-1 12:01:00 600 BILLYBOB
3 2013-1-1 12:04:00 1200 BILLYBOB
4 2013-1-1 12:05:20 500 BILLYBOB
5 2013-1-1 12:06:30 600 BILLYBOB
6 2013-1-1 16:00:00 100 BILLYBOB
7 2013-1-1 18:00:00 300 BILLYBOB
In this case, it would return records 2,3,4,5 since there was over 3 simultaneous sessions, then return the total duration of those records which would be 2900.
Is this asking too much of MySQL?