FWIW, I ran the code below on a test pc in my home (crappy Celeron) and
it generated all 4.1 million combinations in 8 minutes and 32 seconds. 
I'm pretty certain you could do a little better on server hardware.

~Brad


-------- Original Message --------
Subject: RE: Working out yes/no possibilities
From: b...@bradwood.com
Date: Mon, November 23, 2009 10:18 pm
To: cf-talk <cf-talk@houseoffusion.com>


There are 2^22 number of combinations I believe (4,194,304). One of my
favorite ways of doing this is with SQL. Create a temp table with 2
records-- "yes" and "no". Now, join that table to itself 22 times. 
Each join will give you a Cartesian product, or all possible
combinations.

untested, but you get the idea...

DECLARE @question TABLE (answer char(1))
INSERT INTO @question VALUES (0)
INSERT INTO @question VALUES (1)

SELECT q1.answer + q2.answer + q3.answer + q4.answer + q5.answer +
q6.answer + q7.answer + q8.answer + q9.answer ... + q22.answer
FROM @question q1
INNER JOIN @question q2 ON 1 = 1
INNER JOIN @question q3 ON 1 = 1
INNER JOIN @question q4 ON 1 = 1
INNER JOIN @question q5 ON 1 = 1
INNER JOIN @question q6 ON 1 = 1
INNER JOIN @question q7 ON 1 = 1
INNER JOIN @question q8 ON 1 = 1
INNER JOIN @question q9 ON 1 = 1
....
INNER JOIN @question q22 ON 1 = 1



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328640
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to