I have two tables one for the timetable days:
+--------+---------+
| intDay | DayName |
+--------+---------+
| 1 | Mon A |
| 2 | Tue A |
| 3 | Wed A |
| 4 | Thu A |
| 5 | Fri A |
| 6 | Mon B |
| 7 | Tue B |
| 8 | Wed B |
| 9 | Thu B |
| 10 | Fri |
+--------+---------+
And a second table with term dates:
+-----------+------------+------------+
| Term Name | Term Start | Term End |
+-----------+------------+------------+
| Term A | 07/09/2020 | 15/12/2020 |
| Term B | 10/01/2021 | 15/03/2021 |
| Term C | 01/04/2021 | 03/07/2021 |
+-----------+------------+------------+
There is a third table that I can potentially use which contains the calendered week number as well as whether it's week A or B.
The structure for this is:
+-------------+---------+---------+
| intYearWeek | intYear | intWeek |
+-------------+---------+---------+
| 37 | 2020 | 1 |
| 38 | 2020 | 2 |
| 39 | 2020 | 1 |
| 40 | 2020 | 2 |
| 41 | 2020 | 1 |
| 42 | 2020 | 2 |
+-------------+---------+---------+
intYearWeek is the calendared week number of the year, intYear is the academic year (Sep-Jul) and Week A and B is represented as 1 or 2 respectively. These are only teaching weeks so excludes any holiday weeks.
What I'd like to do is generate a list of calendared dates for the whole academic year using the above the two-week cycle but only during term time. I would match these back to the Staff and Pupils timetables to generate an Outlook import.
So if we take Week numbers 37-40 (7th September 2020 - 28th September 2020), the result would look something like this:
+-----------------+------------+
| Week_Number Day | Date |
+-----------------+------------+
| 37 Mon A | 07/09/2020 |
| 37 Tue A | 08/09/2020 |
| 37 Wed A | 09/09/2020 |
| 37 Thu A | 10/09/2020 |
| 37 Fri A | 11/09/2020 |
| 38 Mon B | 14/09/2020 |
| 38 Tue B | 15/09/2020 |
| 38 Wed B | 16/09/2020 |
| 38 Thu B | 17/09/2020 |
| 38 Fri B | 18/09/2020 |
| 39 Mon A | 21/09/2020 |
| 39 Tue A | 22/09/2020 |
| 39 Wed A | 23/09/2020 |
| 39 Thu A | 24/09/2020 |
| 39 Fri A | 25/09/2020 |
| 40 Mon B | 28/09/2020 |
| 40 Tue B | 29/09/2020 |
| 40 Wed B | 30/09/2020 |
| 40 Thu B | 01/10/2020 |
| 40 Fri B | 02/10/2020 |
+-----------------+------------+
Thanks in advance for your help!