Yesterday I posted a puzzle SQL SERVER – Simple Puzzle Using Union and Union All, today we will see the answer of this. Following image explains the answer of puzzle.

You can read the explanation of why this is answer read my previous article SQL SERVER – Union vs. Union All – Which is better for performance?
Reference : Pinal Dave (http://blog.SQLAuthority.com)




[...] : SQL SERVER – Simple Puzzle Using Union and Union All – AnswerReference : Pinal Dave [...]
this is because of union, when ur using union in record than it shows distinct records
yep, the perenthesis are rearanging the order of the unions which is causing the
1 union all (1 union 2) to
(1 union all 1) union 2
trixy!