July 9, 2011 at 11:40 am
Comments posted to this topic are about the item In-CASE you need to SUM...
Ben
^ Thats me!
----------------------------------------
01010111011010000110000101110100 01100001 0110001101101111011011010111000001101100011001010111010001100101 01110100011010010110110101100101 011101110110000101110011011101000110010101110010
----------------------------------------
July 9, 2011 at 11:42 am
Good question today, thank you.
July 11, 2011 at 12:02 am
Nice. First I just summed everything, but then I realized this would be too easy 🙂
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 11, 2011 at 12:16 am
Nice question, but the title is missleading. It isn't about the case and sum, but the union without all keyword.
July 11, 2011 at 12:46 am
palotaiarpad (7/11/2011)
Nice question, but the title is missleading.
.
I guess that was the point 🙂
Putting UNION in the title would give the solution away.
Questions like these remind us that details are important, especially when you are debugging code from someone else.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 11, 2011 at 1:22 am
This was removed by the editor as SPAM
July 11, 2011 at 1:43 am
thanks 🙂
My team leader got it wrong.. 😀
Ben
^ Thats me!
----------------------------------------
01010111011010000110000101110100 01100001 0110001101101111011011010111000001101100011001010111010001100101 01110100011010010110110101100101 011101110110000101110011011101000110010101110010
----------------------------------------
July 11, 2011 at 2:09 am
Nice! 🙂 I got it as i have been playing around with Unions lately. But i could not undertand what makes a difference when it is executed on SQL Server 2008?
Regards,
Mazhar Karimi
July 11, 2011 at 2:23 am
But i could not undertand what makes a difference when it is executed on SQL Server 2008?
It shouldn't. I guess the version is specified because in the past there were troubles with questions where the version did matter (and people lost points et cetera).
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 11, 2011 at 2:29 am
I dont have SQL 2008 here so couldn't test to be 100% sure before posting.
should work exactly the same, but I'm not one to release untested code 😉
Ben
^ Thats me!
----------------------------------------
01010111011010000110000101110100 01100001 0110001101101111011011010111000001101100011001010111010001100101 01110100011010010110110101100101 011101110110000101110011011101000110010101110010
----------------------------------------
July 11, 2011 at 3:11 am
Great question.
I first thought 47, but the 18 in the answers made me hesitate, then the calculation for 18 simply led me back to the insert statement and the UNION (ALL)... Eureka! 🙂
_____________________________________________________________________
[font="Comic Sans MS"]"The difficult tasks we do immediately, the impossible takes a little longer"[/font]
July 11, 2011 at 3:32 am
nice to see people properly dry running it! when I was at college 5/6 years ago the teachers were allways banging on about dry running code and none of the other students could be bothered to work out how to do it.
I find sometimes that it is very easy to get complacent with code - I often type code and hit run to see if it errors rather than actually looking at what I type. when it comes to simple programs that's fine but when it comes to complex logic etc being able to dry run your code in your head is a very important skill to have. When writing code around finances especially - bothering to think logically about your program before you just go ahead and compile it can mean the difference between everything running fine and your company getting investigated over tax problems!
Ben
^ Thats me!
----------------------------------------
01010111011010000110000101110100 01100001 0110001101101111011011010111000001101100011001010111010001100101 01110100011010010110110101100101 011101110110000101110011011101000110010101110010
----------------------------------------
July 11, 2011 at 3:47 am
Thanks. A nice "real-world" question for us developers.
July 11, 2011 at 5:17 am
Great UNION plays a big part....
July 11, 2011 at 5:36 am
Nice question thanks 🙂
Viewing 15 posts - 1 through 15 (of 45 total)
You must be logged in to reply to this topic. Login to reply