"tblContactDetails" with fields "ContactID" and "UserName" and
"tblCommTrack" with fields "CommTrackID", "ContactID", "CommType", "DateContacted"
Case one: tblCommTrack has one row with values: 1,10,1, 2008-03-13 respectively. The following query works, because it doesn't return any rows for the indivudual with ContactID=10 WHERE CommType=1 AND DateContacted=2008-03-13
Expand|Select|Wrap|Line Numbers
- SELECT DISTINCT(d.ContactID), d.UserName FROM tblContactDetails AS d Left Join tblCommTrack AS c ON d.ContactID = c.ContactID WHERE (c.CommTrackID IS NULL OR c.CommType=2 OR (c.DateContacted <> 2008-03-13) ORDER By d.UserName