I need to be able to find first and the second record with sql only if time between those 2 is 15 or more minutes.
Let me put a little example so you can see what I need:
ID| Time | Serial |
1| 10:45| 13 |
2| 11:00| 12 |
3| 11:17| 12 |
4| 11:00| 13 |
7| 11:05| 13 |
8| 11:07| 12 |
I need to get this lines:
ID| Time | Serial |
1| 10:45| 13 |
2| 11:00| 12 |
3| 11:17| 12 |
4| 11:00| 13 |
7| 11:05| 13 |
8| 11:07| 12 |
And output like this:
Time 1 | Time 2 | Serial | Usage
10:45 | 11:00 | 13 | 15min
11:00 | 11:17 | 12 | 17min
EDIT:
I only need to compare 2 records at the same time with the same serial number. And of course go trough all the records.
I have this type of the data in time column:2012-09-06 16:53:05.581