I have a table that has a start and end datetime for a certain event. I am trying to find a way to pivot it out so that every hour that this event occurs has it's own row.
Below is an example of what I'm trying to do. I want to go from the first table to the second table. Does anyone know a good way to do this?
ID | start | end |
1 | 8/30/2012 6:15 | 8/30/2012 8:27 |
2 | 4/4/2012 8:25 | 4/4/2012 14:47 |
3 | 10/4/2010 10:10 | 10/4/2010 10:11 |
ID | Hour | |
1 | 8/30/2016 6 | |
1 | 8/30/2016 7 | |
1 | 8/30/2016 8 | |
2 | 4/4/2012 8 | |
2 | 4/4/2012 9 | |
2 | 4/4/2012 10 | |
2 | 4/4/2012 11 | |
2 | 4/4/2012 12 | |
2 | 4/4/2012 13 | |
2 | 4/4/2012 14 | |
3 | 10/4/2010 10 |
Thanks!!