Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Is it possible...

Author  Topic 

raxbat
Yak Posting Veteran

52 Posts

Posted - 2008-03-20 : 04:36:51
Hello all!

I have a table with numbers(10,25,50,100... etc)

and I have an integer, for example 1000!

Is it possible with query help collect a sum of numbers from the table to get this integer(1000)?

Example: 1000=select from table (10+50+100+100+100... numbers can be repeated

jrogers
Starting Member

34 Posts

Posted - 2008-03-20 : 05:17:27
In your table on numbers are all numbers unique?
do you want the result ot be a select statement or the list of numbers?
is there a limit to the number of numbers you can use.. ie 100 10's or 10 100's, or 1 1000.

thsi is just a form of combinations. I have not done it before in SQL, but i'm sure it's possible
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-03-20 : 05:43:03
i feel I just have to ask... why do want to do that?

Em
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2008-03-20 : 18:59:28
How about 1000 1's? I think there would be 1000*1(1) or ((999 +1(1) +(998+2(1)) etc
or at least 1000 + 1000(1001) possible combinations!

Jim
Go to Top of Page

Haywood
Posting Yak Master

221 Posts

Posted - 2008-03-21 : 10:29:58
quote:
Originally posted by raxbat

Hello all!

I have a table with numbers(10,25,50,100... etc)

and I have an integer, for example 1000!

Is it possible with query help collect a sum of numbers from the table to get this integer(1000)?

Example: 1000=select from table (10+50+100+100+100... numbers can be repeated



You can do _some_ fashion of that using bitwise/bitshifting techniques.
Go to Top of Page
   

- Advertisement -