Solved

# SQL Problem

Posted on 2004-09-07

hi! everybody...well, my problem is the following:

I've got this table:

p monto p q monto q

a 0,995 0 0,005 100.000,00

b 0,998 0 0,002 50.000,00

c 0,991 0 0,009 200.000,00

And need to create another table with the following results

Caso Probabilidad MontoTotal

pa pb pc 0,98407291 0

pa pb qc 0,00893709 200.000,00

pa qb pc 0,00197209 50.000,00

pa qb qc 0,00001791 250.000,00

qa pb pc 0,00494509 100.000,00

qa pb qc 4,491E-05 300.000,00

qa qb pc 0,000010 150.000,00

qa qb qc 9E-08 350.000,00

probability is for example> pa x pb x pc, and MontoTotal monto qa + monto pb + monto pc

I made theses tables in excel...but I would like to do all this job in paradox and quick sql, cause as you may have noticed with only 3 cases the resulting table had 8 rows (2 power 3). Imagine if there are 10 cases (2 power 10) or 1000 (2 power 1000).

so, is there any way to do this in sql??

thanks in advance,

paul.

pd: as I'm using delphi I thought of solving this problem using recursion...what do you think?? would it be faster using sql, if there is any chance to do so??