I have the following situation, where I have some individuals with a start and an end date:
ID | start_date | end_date
1 2015-02-15 2015-04-20
2 2015-03-10 2015-06-15
... ... ...
Now, I need to derive a table with the individuals and all consecutive 30 day periods between their start and end dates (starting from the start_date). The result should look like this:
ID | period | from_date | to_date
1 1 2015-02-15 2015-03-17
1 2 2015-03-18 2015-04-17
2 1 2015-03-10 2015-04-09
2 2 2015-04-10 2015-05-10
2 3 2015-05-11 2015-06-10
Do you have any idea how to create such a table in a clever way in MySQL? If MySQL is too cumbersome for such a data manipulation, R or Excel will work for me as well.