Select Statement to show missing records (Easy Question)

Posted by Gerhard Weiss on Stack Overflow See other posts from Stack Overflow or by Gerhard Weiss
Published on 2010-04-30T18:46:08Z Indexed on 2010/04/30 18:57 UTC
Read the original article Hit count: 360

Filed under:
|

I need some T-SQL that will show missing records.

Here is some sample data:

Emp 1
01/01/2010
02/01/2010
04/01/2010
06/01/2010

Emp 2
02/01/2010
04/01/2010
05/01/2010
etc...

I need to know

Emp 1 is missing 
03/01/2010
05/01/2010

Emp 2 is missing 
01/01/2010
03/01/2010 
06/01/2010

The range to check will start with todays date and go back 6 months.

In this example, lets say today's date is 06/12/2010 so the range is going to be 01/01/2010 thru 06/01/2010.

The day is always going to be the 1st in the data.

Thanks a bunch. :)

Gerhard Weiss
Secretary of Great Lakes Area .NET Users Group
GANG Upcoming Meetings | GANG LinkedIn Group

© Stack Overflow or respective owner

Related posts about tsql

Related posts about sql-server