'EXCEPT' will show any distinct value from first query result that is not found in second query result.
Select itemid from itemmaster except Select itemid from stock
'INTERSECT' will show any distinct values, which are common in both first & second query results.
Select itemid from itemmaster intersect Select itemid from stock
The datatype and no of columns should be same in all the queries.
Published under: SQL Server Tips · · · ·
What versions of sql does this apply to.
i checked in 2008 enterprise edition, may be in 2005 also.
Yep, it works on 2005.
Yes it is available for 2005 and later version. good post Deepak