i have a table tableData
(startTime, endTime, data)
For example,
startTime | endTime | data
2000-01-01 03:00:00 | 2000-01-01 03:00:10 | 88
2000-01-01 03:00:10 | 2000-01-01 03:00:20 | 33
2000-01-01 03:00:30 | 2000-01-01 03:00:40 | 67 ......and so on
i would like the entry(2000-01-01 03:00:20,2000-01-01 03:00:30,0
) to be inserted in data whenever there is no data , hence 0. the output would be :-
startTime | endTime | data
2000-01-01 03:00:00 | 2000-01-01 03:00:10 | 88
2000-01-01 03:00:10 | 2000-01-01 03:00:20 | 33
**2000-01-01 03:00:20 | 2000-01-01 03:00:30 | 0**
2000-01-01 03:00:30 | 2000-01-01 03:00:40 | 67 ..... and so on
What is the easiest possible way to do this.
Please i need it done by today or my boss is gonna kill me.
Thanks guys.
Is there any way to check if the endTime of the previous row is equal to the startTime of the current row and insert into the table accordingly?
MORE INFO :-
This is the stored procedure im using now to accumulate the from the inputTable and store it into the output table using 10 second intervals. http://sqlfiddle.com/#!2/838de/1