My table consists of 3 columns: Worker Names, and their availability dates (from and to):
workers | available from | available to |
---|---|---|
Aiden | 2022-05-13 | / |
Iona | 2022-05-13 | / |
Connie | / | 2022-05-16 |
Connie | 2022-05-13 | / |
Connie | / | 2022-05-23 |
Karen | 2022-05-13 | / |
Karen | / | 2022-05-16 |
There is also a specified interval: from 2022-05-15 to 2022-06-03
My goal is to sort and merge the table results to include the best available dates within the specified interval:
workers | available from | available to |
---|---|---|
Aiden | 2022-05-13 | / |
Iona | 2022-05-13 | / |
Connie | 2022-05-13 | 2022-05-16 |
Karen | 2022-05-13 | 2022-05-16 |
In the case of Connie, we extend the availability to 2022-05-16 based on the later date of 2022-05-23.
I have attempted using array comparison within "for" loops, but the code is lengthy, slow, and not achieving the desired outcome. Any assistance would be greatly appreciated!