I have a table as:
ID RECORD_DATE
1 2012-12-15 00:00:00
2 2012-12-16 00:00:00
3 2012-12-17 00:00:00
4 2012-12-17 16:00:00
Now I need to calculate the time between the adjacent date, so it would look like:
start end difference
2012-12-15 00:00:00 2012-12-15 23:59:59 23:59:59
2012-12-16 00:00:00 2012-12-16 23:59:59 23:59:59
2012-12-17 00:00:00 2012-12-17 16:00:00 16:00:00
Is there any efficient way to do this kind of calculation on the database side?
All help is appreciated.