I have a table like the below.
id month duration
001 1/1/16 3
002 3/1/16 4
003 12/1/15 2
I would like to add a new row to the table for every month after the month shown for the number specified minus 1, e.g. below:
id month duration
001 1/1/16 3
001 2/1/16 3
001 3/1/16 3
002 3/1/16 4
002 4/1/16 4
002 5/1/16 4
002 6/1/16 4
003 12/1/15 2
003 1/1/16 2
And so on, while duplicating the values in any column not shown.
I have done this in R, where I first populated 'short' data and then reshaped it to long, but after searching online, I still have no idea how to do this in mySQL. Thanks in advance for your help!