I have a table of items, each with a timestamp connected to it. I want to find the largest interval between any pair of consecutive items. Is this possible with a query only?
UPDATE: Let me see if I can make this a little less confusing. What I want to do is compare each items timestamp to the item before and after it, to find out how much time has passed between the two times. I want to do that for all the items, and at the end have the largest difference between two items.
I dont want the largest difference between any two items because that would obviously be the first and last item. Hopefully that description is clearer.
UPDATE2: So quickly after accepting an answer, I realized I again wrongly described the problem. The new issue is that the items ids aren't in the same order as the timestamp.
I'm going to try to describe the problem with some data...
Item - Time (seconds) Item0 - 000 Item1 - 030 Item2 - 120 Item3 - 090 Item4 - 100
So for the items above, I want 60 seconds (between item1 and 3) but Martin's (great) answer would return 90 seconds (item1 and 2)