September 22, 2011 at 11:12 am
Good question, highlighting that union doesn't simply remove a duplicated row where the duplicate exists on both sides of the union, but will also remove a duplicated row where the duplicate rows exist on one side of the union.
September 22, 2011 at 5:04 pm
.Thanks for the question
---------------------------------------------------------------------
Use Full Links:
KB Article from Microsoft on how to ask a question on a Forum
September 22, 2011 at 8:29 pm
Cliff Jones (9/22/2011)
Yes, I saw 1,2,3 and almost forgot to count the null value. Good straight forward question with all the likely wrong answers.
I did forget to count the NULL 🙁
September 22, 2011 at 8:36 pm
SQL Kiwi (9/22/2011)
Cliff Jones (9/22/2011)
Yes, I saw 1,2,3 and almost forgot to count the null value. Good straight forward question with all the likely wrong answers.I did forget to count the NULL 🙁
This makes me feel much better. Thanks for being honest 😀
/* Anything is possible but is it worth it? */
September 22, 2011 at 9:13 pm
SQL Kiwi (9/22/2011)
Cliff Jones (9/22/2011)
Yes, I saw 1,2,3 and almost forgot to count the null value. Good straight forward question with all the likely wrong answers.I did forget to count the NULL 🙁
I nearly missed the null. I glanced over it and then rechecked just before submitting.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 22, 2011 at 9:48 pm
Interesting question!!
Thanks.
September 23, 2011 at 12:56 am
Easy question, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
September 23, 2011 at 9:09 am
Good question.
I nearly counted NULL twice, but remembered in time that the deduplicate operation uses the version of "=" that makes NULL = NULL true.
Tom
September 23, 2011 at 9:19 am
Nice question, thanks!
September 23, 2011 at 11:15 am
I found it interesting that the execution plan for the union in the question was the same as if I had done a distinct from the union all
select distinct a from
(select a from a
union all
select a from a) b
In both cases, it did a Concatenation of the two result sets then did a Distinct Sort.
It makes perfect sense that this is how the process would work, once I looked at it, but I thought it was interesting regardless.
I'm pretty easily amused though. :w00t:
September 26, 2011 at 10:09 pm
Easy & Straight forward question..
Thanks
September 30, 2011 at 3:50 am
SQL Kiwi (9/22/2011)
Cliff Jones (9/22/2011)
Yes, I saw 1,2,3 and almost forgot to count the null value. Good straight forward question with all the likely wrong answers.I did forget to count the NULL 🙁
+1
I didn't see it at all. My bad.
-- Gianluca Sartori
November 27, 2011 at 9:22 am
Good question.
I didn't realize that the union would affect the first table as well. Was expecting both of the 1's to still be intact and therefore give 5 instead of 4......
Viewing 13 posts - 16 through 27 (of 27 total)
You must be logged in to reply to this topic. Login to reply