This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
joining_two_timelines [2016/03/01 08:06] markmeteenk created |
joining_two_timelines [2016/03/01 08:42] (current) markmeteenk |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | This code is not yet thoroughly tested. | ||
- | Create a unique list of start dates per key. | + | - Create a unique list of start dates per key. |
- | Join the lowest end date that is more recent than the start date per key. | + | - Join the lowest end date that is more recent than the start date per key. |
- | Order the list by by start date from new to older and get the value of start date and end date of the previous row. | + | - Order the list by by start date from new to older and get the value of start date and end date of the previous row. |
- | If the previous row is not empty and the end date is more recent then the start of the previous row, then replace the end date with the start date of the previous row. | + | - If the previous row is not empty and the end date is more recent then the start of the previous row, then replace the end date with the start date of the previous row. |
Example in SQL Server: | Example in SQL Server: | ||
+ | <code> | ||
BEGIN | BEGIN | ||
-- Drop temporary tables | -- Drop temporary tables | ||
Line 140: | Line 141: | ||
END | END | ||
+ | </code> |