Forum Discussion

markgsmith01's avatar
markgsmith01
Frequent Visitor
2 years ago
Solved

Returning values from a many to many relationship

I have an event table and an employee table that share a many to many relationship. I want to to polulate the role that an employee had at the time of the event. For example, the first event occurred to "Bob" on 1/4/2020, and I can see in the Employee table that  he was an Analyst at that date. But he was a consultant when the second event that involved "Bob" occurred.

 

Event Table

DateName
1/04/2020Bob
1/07/2020Bob
3/05/2021Jill
13/02/2022Fred


Employee Table

NameRoleStart DateEnd Date
BobAnalyst1/01/20201/06/2020
BobConsultant2/06/20201/01/2023
JillConsultant15/07/20183/12/2020
JillTrainer4/12/20201/01/2023
FredAnalyst1/05/2021

1/01/2023

 

Desired Result Event Table

DateNameRole
1/04/2020BobAnalyst
1/07/2020BobConsultant
3/05/2021JillTrainer
13/02/2022FredAnalyst

 

I've been banging my head against the wall for a while on this but I figure it shouldn't be that hard!?! Any help would be appreciated.

2 Replies