example database:
major_task---minor_task---userid---time--------action
-----------------------------------------------------
task1---------------------123------1234567891---200 (start1)
task2---------------------456------1234567899---200 (start1)
task1---------------------123------1234567999---210 (pause)
-------------task3--------789------1234569999---300 (start2)
task1---------------------123------1234599988---301 (resume)
task1---------------------123------1234599999---999 (end)
I need a way to total the time for task1. The difficult part is that most of the time user1 will begin task1 and user2 will begin task2 before the first user ends his task. The good news is each record has an action associated with it. I need mysql to isolate a given taskid associated with a start action then find the next record with the same taskid associated with a stop action. Do the math and store the data in another table. Is this possible with mysql?
major_task---minor_task---userid---time--------action
-----------------------------------------------------
task1---------------------123------1234567891---200 (start1)
task2---------------------456------1234567899---200 (start1)
task1---------------------123------1234567999---210 (pause)
-------------task3--------789------1234569999---300 (start2)
task1---------------------123------1234599988---301 (resume)
task1---------------------123------1234599999---999 (end)
I need a way to total the time for task1. The difficult part is that most of the time user1 will begin task1 and user2 will begin task2 before the first user ends his task. The good news is each record has an action associated with it. I need mysql to isolate a given taskid associated with a start action then find the next record with the same taskid associated with a stop action. Do the math and store the data in another table. Is this possible with mysql?