January 16, 2008 at 10:51 pm
Hi All,
Please anyone help me for this.
In my table i have a column named as SID
and Values like this...
SID
----
1
2
3
4
5
---------------------
I need a Query which can give the multiply of Sid Column
Like 1*2*3*4*5
The Result Should be 120 as Result Column
Result
-----
120
the result should be this format....
NB: Query should be Only Select Statement..
Cheers!
Sandy.
--
January 16, 2008 at 11:22 pm
Actually, this looks like a standard "factorial" homework problem. What do you need this for?
--Jeff Moden
Change is inevitable... Change for the better is not.
January 16, 2008 at 11:27 pm
Hi Jeff,
Its one of the requirement,
Is it possible by using single Query....??
I am using TSQL for this by
taking Temp table and Going row by row....
So Any Idea..
Cheers!
Sandy.
--
January 16, 2008 at 11:45 pm
Jeff,
Where is Grant....???
😉
Cheer!
Sandy.
--
January 16, 2008 at 11:49 pm
Answer the question, Sandy... what do you need this for? "Its one of the requirement" isn't an answer. It's homework, isn't it?
--Jeff Moden
Change is inevitable... Change for the better is not.
January 17, 2008 at 12:04 am
Sandy,
Why do you need this particular code? It seems like homework.
Here is a hint.
You should use the sum of log(sid) and natural logarithm 2.71828182845905 (sql has built in function for this)
January 17, 2008 at 12:08 am
Jeff,
he he he..lolz...:P ....
Now you will tell me....hee hee ..in my shop.....;)
Please Tell me the Answer,
Jeff, Is it possible or Not?
Please ....
Cheers!
Sandy.
--
January 17, 2008 at 12:12 am
Hey Adams,
Can you please write the Sql query for this?
:w00t::hehe::cool:
Cheers!
Sandy.
--
January 17, 2008 at 12:20 am
Sandy (1/17/2008)
Jeff,he he he..lolz...:P ....
Now you will tell me....hee hee ..in my shop.....;)
Please Tell me the Answer,
Jeff, Is it possible or Not?
Please ....
Cheers!
Sandy.
Heh... in my shop, I tell people to do their own homework. 😉
And, to answer your question, yes, it is possible... that's why they give the problem as homework... to see if you've been paying attention. 😛
Please do your own homework. :w00t:
--Jeff Moden
Change is inevitable... Change for the better is not.
January 17, 2008 at 12:27 am
Jeff,
Clearly Cheating.....;)!!!
Jeff, I already did it by using Dynamic TSQL,
but how can it possible in One single Select Query?
Ok, Let me try today evening ...
if not you will give the answer tomorrow..
Ok..
But Jeff, Please look to my another Post,
its important for me...
Waiting for ur suggestion.....
Thanks
Cheers!
Sandy.
--
January 17, 2008 at 12:41 am
What other post? Post the URL so I don't have to look for it. 😉
On the homework, the method that Adam is leaning towards is not the method your instructor wants you to use. It's easy with the formula that Adam is implying... not so easy with the method your instructor wants you to use... but it's meant to teach you a little bit about some of the new functions WITH SQL Server 2005.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 17, 2008 at 12:48 am
Hi Sandy,
Try out this ....
SELECT EXP(SUM(LOG(SID))) FROM #t
😛
January 17, 2008 at 12:56 am
sqluser (1/17/2008)
Hi Sandy,Try out this ....
SELECT EXP(SUM(LOG(SID))) FROM #t
😛
Man, some people just don't get it... Who's goin' for the "A"... YOU?
Although that's a better answer in the software world, I guarantee that's not the answer Sandy's instructor is looking for... and Sandy learned nothing about what Sandy was supposed to learn... except how to cheat. Great job, Pal!
--Jeff Moden
Change is inevitable... Change for the better is not.
January 17, 2008 at 2:16 am
Hey sqluser,
Thanks, It is working...
Jeff,
Actually I asked about this post...
" http://www.sqlservercentral.com/Forums/Topic444141-338-1.aspx "
Jeff,
-------------
Sandy learned nothing about what Sandy was supposed to learn... except how to cheat. Great job, Pal!
he he he...lolz:hehe:
Cheers!
Sandy.
--
January 17, 2008 at 3:34 am
Create a function that calculate these values and call that function thru select query
Viewing 15 posts - 1 through 15 (of 23 total)
You must be logged in to reply to this topic. Login to reply