Hi,
I tried dense ranking but that too groups in an order not required. Also, I thought I will explain the scenario. A vehicle moves across places sending Lat/Lon values at various times. If it moves along 'A', then 'B' and then 'A' again, we need to know how long it was at 'A', then 'B' and then again 'A'.
Thus we need get,
Correct Result
PlaceName|FromDate|ToDate
A|01-Jan-2010 11:30|01-Jan-2010 11:50 (R1)
B|01-Jan-2010 11:55|01-Jan-2010 12:10 (R2)
A|01-Jan-2010 12:15|01-Jan-2010 12:25 (R3)
Where
PlaceName|AtDate
A|01-Jan-2010 11:30 (R1)
A|01-Jan-2010 11:35
A|01-Jan-2010 11:40
A|01-Jan-2010 11:45
A|01-Jan-2010 11:50 (R1)
B|01-Jan-2010 11:55 (R2)
B|01-Jan-2010 12:00
B|01-Jan-2010 12:05
B|01-Jan-2010 12:10 (R2)
A|01-Jan-2010 12:15 (R3)
A|01-Jan-2010 12:20
A|01-Jan-2010 12:25 (R3)
Thanks Again