Hi

Can anyone help, or point me in the right direction?

I have a MySQL database. The table contains rows of "events" a person has triggered. It also contains a "datetime" field of the event.

If the person is currently triggering the event, there will be a row in the databse every 30-60 seconds. If the event stops, there will be no row added.

A person can trigger an event several times is a day. What I want to do is output the total time for each event...

Heres an example of the table content:

Person, datetime
-------------------

Joe, 2008-01-26 16:15:46
Joe, 2008-01-26 16:15:16
Joe, 2008-01-26 16:14:46
Joe, 2008-01-26 16:14:16
Joe, 2008-01-26 14:45:45
Joe, 2008-01-26 14:45:15
Joe, 2008-01-26 14:44:45
Joe, 2008-01-26 14:44:17
Joe, 2008-01-26 14:43:45

I want to get an output like

Joe - 90s
Joe - 120s

(ie the time difference between the first and last times of each event group)

Any ideas?