I've a table in which every x seconds a position is being written to. The table consists of the following columns:
lat | lon | time | .....
The ultimate goal is to make the track visible on a map with on the points where the device halted displaying a image. On the points where there are more than one entries over time the rows should be added together to display a row with a 'timeSpent' at the location which is the difference of the different rows at the same location. So:
lat | lon | timeFirst | timeSpent
For instance this is the 'raw' table:
x1,y1, 13:00:12 // Point 1
x1,y2, 13:01:34 // Point 2
x3,y3, 13:02:01 // Point 3
x3,y3, 13:03:03 // Point 3
x3,y3, 13:04:34 // Point 3
x3,y3, 13:05:12 // Point 3
x4,y6, 13:06:23 // Point 4
On point 3 there are multiple entries. Which should be joined together to the following table:
x1,y1, 13:00:12, null
x1,y2, 13:01:34, null
x3,y3, 13:02:01, 13:05:12
x4,y6, 13:06:23, null
I would really love to have a native MySQL query which makes the result table. But if it's necessary I could use PHP to parse the source table.
Can anyone help me to get the wanted table?