I have 2 records, one details when the stop clock was stopped and the other started. I only have the one date value in each record. I'm trying to work out the difference between the stop and start dates. I'm looking for pointers. I thought by doing something like:
SELECT e1.ID, MIN(e1.EventTime) AS [StopTotalMinutes] ,MAX(e2.EventTime) AS [StartTotalMinutes] FROM event AS e1 JOIN event AS e2 ON e1.ID = e2.ID
I would have been able to work something out, but I'm failing.
So, Table and some sample data is:
ID | EventTime | Action 1 2012-01-01 10:00 Stop 1 2012-01-01 13:31 Start 1 2012-01-03 09:45 Stop 2 2012-01-01 11:12 Stop 2 2012-01-10 15:35 Start 2 2012-01-11 08:39 Stop