MS SQL Union (Selects Distinct Values)

here’s a wake up call for devs who use SQL Unions infrequently. at work we recently tripped up on a bug with a stored proc… well it was actually just that we had forgotten that with UNION, only distinct values are selected! oops.

so remember: The UNION ALL command is equal to the UNION command, except that UNION ALL selects all values.

gotta love W3Schools >> http://www.w3schools.com/sql/sql_union.asp

ok so don’t poke fun… we just don’t need or use Union much and this little fact slipped through… don’t let it happen to you… you’ve been warned!