Hi there,
I hope you expert could help me figure out how to make a query within same Oracle table. I spent quite some time but still have no clue. Details of my question as follows:
Assume a table contains value in datetime (YYYYMMDDHH24) format:
2006101101
2006101102
2006101104
2006101105
2006101106
2006101110
...
I need to compare two records at a time to get the difference in hour between the two records. The expected result looks like:
begin_time end_time gap_of_hours
2006101101 2006101102 1
2006101102 2006101104 2
2006101104 2006101105 1
2006101105 2006101106 1
2006101106 2006101110 4
...
Can anyone helps me how to do it?
Many thanks!
Cheers,
David
I hope you expert could help me figure out how to make a query within same Oracle table. I spent quite some time but still have no clue. Details of my question as follows:
Assume a table contains value in datetime (YYYYMMDDHH24) format:
2006101101
2006101102
2006101104
2006101105
2006101106
2006101110
...
I need to compare two records at a time to get the difference in hour between the two records. The expected result looks like:
begin_time end_time gap_of_hours
2006101101 2006101102 1
2006101102 2006101104 2
2006101104 2006101105 1
2006101105 2006101106 1
2006101106 2006101110 4
...
Can anyone helps me how to do it?
Many thanks!
Cheers,
David