Reputation: 1
I have a table I am trying to connect to to give me a name (however this name table has multiply entries for a name).
StaffName | dateFrom | dateTo |
---|---|---|
JIAO-L | 2023-03-17 | NULL |
JIAO-M | 2017-07-25 | 2023-03-16 |
I want to being back the name based on on date of 3/4/23
, however when I try various joins they are coming up as null.
I have tried this code in many formats changing the
SELECT e.eventdate
, e.StaffCode
, sn.
FROM Events e
LEFT JOIN StaffName Sn
ON e.StaffCode = sn.StaffCode
AND e.eventdate !> sn.dateto
AND e.eventdate !< sn.datefrom
Upvotes: 0
Views: 26