Needed to start a new thread to deal with a new issue from old problem.
Original problem is at this link.... complex query join checking that value does not exist
I have two tables, first has
Tb1 = drID, schedDate, rteID
Second has:
Tb2 = drID, FName, LName, Active
tb1 schedDate has a value for 11/12/2012 but returns no records, if I enter 11/01/2012 I get the correct records back, but this date does not exist on any record in tb1.
SELECT drID, Fname, LName
FROM TB2
WHERE Active = True
AND drID NOT IN (
SELECT drID
FROM Tb1
WHERE (drID IS NULL OR drID = '')
AND (schedDate = (@targetDate)
)
Both date fields are dates I have tried casting each individually and both together as in...
AND (CAST(schedDate AS DATE) = CAST(@targetDate AS DATE))
and
AND (CAST(schedDate AS DATETIME) = CAST(@targetDate AS DATETIME))
I am trying to check that no drID exists in tb1 on the date submitted.