November 4, 2012 at 1:14 am
Comments posted to this topic are about the item SUM and Addition of Null
November 4, 2012 at 1:43 am
π Simply Nice.
(note: aliasing the columns in the first select statement will be enough)
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
November 4, 2012 at 10:23 pm
Really Nice !
Simple and Best. π
--Angad
(Truth is Higher, Still Higher is Truthful Living)
--Angad Singh
If I Stop Learning, I Cease to Be A SIKH !
November 4, 2012 at 11:11 pm
Nice question to start week with +1 π
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
November 4, 2012 at 11:38 pm
Easy one for the Monday π
Especially easy because the way the answers were structured, you only had to calculate the last column π
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
November 5, 2012 at 1:50 am
Excellent question, thanks very much. Have a good week.
---
Note to developers:Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
My blog: http://uksqldba.blogspot.com
Visit http://www.DerekColley.co.uk to find out more about me.
November 5, 2012 at 2:11 am
Nice & Easy one..
Thanks
November 5, 2012 at 4:11 am
Remember that SUM may return NULL, so SUM(num1)+SUM(num2) may lead to NULL:
select
sum(num1) AS S1,
sum(num2) AS S2,
sum(num1) + sum(num2) AS S3,
sum(num1 + num2) AS S4
from
(
select cast('1' as int) as num1, cast(NULL as int) as num2
union all
select '1' as num1, NULL as num2
union all
select '1' as num1, NULL as num2
union all
select NULL as num1, NULL as num2
) as t
The above select return 3,NULL,NULL,NULL
November 5, 2012 at 4:46 am
Thanks for an easy start to the week
-------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. β Carl Sagan
I would never join a club that would allow me as a member - Groucho Marx
November 5, 2012 at 5:09 am
good one Carlo
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
November 5, 2012 at 6:25 am
Thanks for the nice start to the week!
November 5, 2012 at 6:55 am
Easy and interesting question.Ta.
βWhen I hear somebody sigh, βLife is hard,β I am always tempted to ask, βCompared to what?ββ - Sydney Harris
November 5, 2012 at 7:07 am
Nice and easy question.
Back to basics, really, but quite a few basics: aggregates, aggregates' handling of nulls, arithmetic operations handling of nulls, and implicit type conversion (as well as simple arithemetic) :-).
Tom
November 5, 2012 at 10:11 am
Cheers for something easy on a Monday! :satisfied:
Aigle de Guerre!
November 5, 2012 at 9:02 pm
easy π thanks
Viewing 15 posts - 1 through 15 (of 19 total)
You must be logged in to reply to this topic. Login to reply