I have two tables that are joined via a LEFT join so I see all the records in table 1 and only those in table 2 where the joined field (SeqNum) match. SeqNum may be null in Table 1. Everything is working fine. But now I need to do the join, but conditionally, sort of. Let me explain:
I want it to continue to show all records from Table one, and if SeqNum is not null in table 1, then join on SeqNum AND WorkOrder. As oyu can see, the issue is thgat SeqNum can be null, so i can't just join on WorkOrder in a previous query and then do the LEFT join. Ideas?
I got very little sleep last night so it is possible my brain is just not working this morning.
If I correctly understand what you try to achieve (not sure I am), it would be something like:
SELECT Tbl_CF_DATA.*, Tbl_LCF_Data.*
FROM Tbl_CF_DATA LEFT JOIN Tbl_LCF_Data ON
(Tbl_CF_DATA.WorkOrder = Tbl_LCF_Data.WorkOrder) AND
(Tbl_CF_DATA.SeqNum = Tbl_LCF_Data.SeqNum)
WHERE (Tbl_CF_DATA.SeqNum Is Not Null);