Fiddle: http://sqlfiddle.com/#!18/76ced/2
I've got two tables - Roster and Sample. The Roster table contains information on what days an employee has worked across a period of two weeks. The Sample table contains a sample weekly roster.
I want to know how the days in Roster and Sample differ across each week of the Roster. Basically want something like the below table:
Week | Roster Day | Sample Day |
---|---|---|
1 | NULL | Monday |
1 | Tuesday | Tuesday |
1 | Wednesday | Wednesday |
1 | Thursday | Thursday |
2 | Monday | Monday |
2 | Tuesday | Tuesday |
2 | Wednesday | Wednesday |
2 | Thursday | Thursday |
2 | Friday | NULL |
I've tried doing a simple outer join between the two tables but that did not give the desired result. It looks like I may need to do a cross join but I'm not sure how to incorporate that either. Any help would be appreciated.