UNION includes items only once, even if they exist in both sets.
UNION ALL includes items twice if they exist in both sets.
SELECT 'first' UNION
SELECT 'first'
= 'first'
SELECT 'first' UNION ALL
SELECT 'first'
= 'first', 'first'
Neat. This made me wonder if INTERSECT exists in TSQL. To my delight, both
INTERSECT and EXCEPT exist.
No comments:
Post a Comment