Q:

Query that filters out results if they exist in a second table

I have two tables.  First is a table Employees the second is TimeCard.  I am trying to determine when employees are not here.  Sample Tables:

So an employee name is returned if it meets the following criteria: Status = 1 and Date != '8/27/13'.  However I only want an Employee returned once even if they have multiple entires in the TimeCard table as long as they are not on a specified date.

A:

Try the following:
SELECT e.employee FROM employees e 
WHERE status=1 
AND NOT EXISTS ( SELECT 1 FROM timecard t 
                 WHERE t.employee=e.employee 
                 AND t.Date = '8/27/13') 

where '8/27/13' will work only, if date is a varchar column. Otherwise you should use a more standard date format like '2013-8-27'.
Edit:
In MSSQL '8/27/13' will actually work, but it is still not a good idea to use this notation as it is not unambiguous when smaller numbers are used, like '5/6/7'. Depending on who entered it (and from which country they come), this could mean either May 6 2007, or 2005 May the 7th or 5 June 2007 ...
2. Edit:
Evidently not a good idea to prepare supper while you are putting together a SQLfiddle! The whole thing was buggy. I just fixed it and, of course corrected the typo with t.Date != '8/27/13' sorry for the confusion! See the corrected fiddle here: http://sqlfiddle.com/#!3/26454/1

