create table #temp_test (id int) insert into #temp_test values(1) insert into #temp_test values(NULL) insert into #temp_test values(2) insert into #temp_test values(3) insert into #temp_test values(2) select count(distinct id) from #temp_testWhat will be the result ? Choose your answer: 4 5 3 Correct answer: 3 Explanation: Distinct count() never considers NULL as a distinct value since NULL can be the same of other value. According to the documentation, COUNT returns unique, non-null values. Ref: COUNT - http://msdn.microsoft.com/en-us/library/ms175997.aspx
09/10/2013
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment