I have 2 tables of data. 1 table has a list of start and end date ranges. The other table a list of students with their class and start dates. For each of the date ranges, I'm trying to list the students who have a start date in that range.
Range Data
| Start | End |
|---|---|
| 10/1/2023 | 12/31/2023 |
| 7/1/2023 | 9/30/2023 |
| 4/1/2023 | 6/30/2023 |
| 1/1/2023 | 3/31/2023 |
Student
| Learner | Course | Start |
|---|---|---|
| 1 | English | 11/5/23 |
| 1 | Math | 7/10/23 |
| 2 | English | 7/25/23 |
| 2 | Math | 5/15/23 |
| 3 | Science | 4/25/23 |
| 3 | Math | 7/25/23 |
| 3 | English | 11/15/23 |
| 4 | Science | 11/5/23 |
| 4 | Math | 1/5/23 |
If I only have a single date range to filter against, I can do this using filter() to filter by start dates, but I have a dozen different ranges and don't want to run in manually for each range. My intended outcome is a list of ranges with the students having a class in that range
| Start | End | Learner |
|---|---|---|
| 10/1/2023 | 12/31/2023 | 1 |
| 10/1/2023 | 12/31/2023 | 3 |
| 10/1/2023 | 12/31/2023 | 4 |
| 7/1/2023 | 9/30/2023 | 1 |
| 7/1/2023 | 9/30/2023 | 2 |
| 7/1/2023 | 9/30/2023 | 3 |
| 4/1/2023 | 6/30/2023 | 2 |
| 4/1/2023 | 6/30/2023 | 3 |
| 1/1/2023 | 3/31/2023 | 4 |