Hi all,
Hoping someone can help me with query I'm having trouble with. I want to do a left join and keep all records in Table 1, and matching records in Table 2 where Table 1 ID = Table 2 ID, AND Table 1 RowDate is between Table 2 StartDate and EndDate.
I'm going to try to attach a sample DB, but here is my table set up below in case it doesn't work:
Table 1 columns:
EmployeeID
EmployeeName
RowDate
Metric
Table 2 columns:
EmployeeID
Supervisor
StartDate
EndDate
Expected Query Result:
EmployeeID
EmployeeName
RowDate
Metric
Supervisor
In the expected query result, I want all rows from Table 1. Then the Supervisor value can be null when it can't find the EmployeeID at all, or when it can't find the RowDate between Start and End dates for an employee in Table 2.
Thanks for looking!
Hoping someone can help me with query I'm having trouble with. I want to do a left join and keep all records in Table 1, and matching records in Table 2 where Table 1 ID = Table 2 ID, AND Table 1 RowDate is between Table 2 StartDate and EndDate.
I'm going to try to attach a sample DB, but here is my table set up below in case it doesn't work:
Table 1 columns:
EmployeeID
EmployeeName
RowDate
Metric
Table 2 columns:
EmployeeID
Supervisor
StartDate
EndDate
Expected Query Result:
EmployeeID
EmployeeName
RowDate
Metric
Supervisor
In the expected query result, I want all rows from Table 1. Then the Supervisor value can be null when it can't find the EmployeeID at all, or when it can't find the RowDate between Start and End dates for an employee in Table 2.
Thanks for looking!
Last edited: