January 31, 2015 at 5:16 pm
Comments posted to this topic are about the item Group By, Count, and NULLs
February 1, 2015 at 5:14 am
Maybe tomorrow QoTD will be:
COUNT(*) AS MyCount
And MyCount value will be 2 in this case (*) for the Null rows
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
February 1, 2015 at 9:48 pm
Easy Question.
February 1, 2015 at 11:37 pm
Hany Helmy (2/1/2015)
Maybe tomorrow QoTD will be:
COUNT(*) AS MyCount
And MyCount value will be 2 in this case (*) for the Null rows
+1
Or, using field "Mychar" in the aggregate function instead of MyId
To Author: Thank you for the post, really good one and I liked the twist of logic happening in my head.
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
February 2, 2015 at 12:46 am
Good to know that group by lumps the nulls.
Thanks
Igor Micev,My blog: www.igormicev.com
February 2, 2015 at 1:06 am
This was removed by the editor as SPAM
February 2, 2015 at 1:10 am
Great question, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
February 2, 2015 at 6:48 am
Thanks for the question. We've had a bunch of these COUNT questions lately.
February 2, 2015 at 7:21 am
Hany Helmy (2/1/2015)
Maybe tomorrow QoTD will be:
COUNT(*) AS MyCount
And MyCount value will be 2 in this case (*) for the Null rows
Almost got it wrong for *assuming* the count was of the MyChar column. It pays to double-check!
I thought tomorrow's question might be:
COUNT(MyChar) AS MyCount
where MyCount value will also be 2.
February 2, 2015 at 8:52 am
Why are we getting so many count with null questions recently?
February 2, 2015 at 9:02 am
ZZartin (2/2/2015)
Why are we getting so many count with null questions recently?
1. Good review
2. Helps those less experienced
February 2, 2015 at 11:16 am
I appreiate the questions lately. I think it's good to know the different ways that functions work, especially when dealing with NULLs. The basics are always good to know - they're the basics. I learned something from the SOME question a few days ago.
February 2, 2015 at 5:46 pm
+1 - thanks for the question.
February 2, 2015 at 9:56 pm
Good Question...
That's why I prefer using count(1)
Pramod
SQL Server DBA | MCSE SQL Server 2012/2014
in.linkedin.com/in/pramodsingla/
http://pramodsingla.wordpress.com/
Viewing 15 posts - 1 through 15 (of 18 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy