People are capable of all kinds of good thinking, but some just don't see what's right in front of their noses.
Home
 

EXCEPT and INTERSECT (Transact-SQL)

They both return distinct values by comparing the results of two queries.

EXCEPT returns any distinct values from the left query that are not also found on the right query.

INTERSECT returns any distinct values that are returned by both the query on the left and right sides of the INTERSECT operand.

The basic rules for combining the result sets of two queries that use EXCEPT or INTERSECT are the following:

  • The number and the order of the columns must be the same in all queries.
  • The data types must be compatible.

Syntax

{ <query_specification> | ( <query_expression> ) }
{ EXCEPT | INTERSECT }
{ <query_specification> | ( <query_expression> ) }

July 2, 2013 This post was written by Categories: ITSQL No comments yet


Leave a Reply

Top