find unmatched rows

I wanted to create a query that would return the reverse inverse of two sets, where the sets are defined using multiple where clauses restricting columns. The idea was to compare the set of all possible employee days in a given month with actual entries of time on each day, and find the unmatched rows. Because SQL server doesn’t support the EXCEPT keyword, I had to figure out how to do it using traditional SQL. May be useful, since it is easy for people to understand but not that obvious how to get a computer to do it.

Here is the resulting query itself:

query

 

According to the link below, this is implemented on Oracle as the MINUS keyword.

http://www.dbazine.com/db2/db2-disarticles/gulutzan3

Advertisements

What do you think? Leave a comment.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s