hello
I have manually constructed table tblTemplates that has over 300 rows. I'd like to know if SQL could be used to generate this table automatically.
The table looks like this...
ID P1 P2 P3 P4 P5 P6 P7 P8 P9 P10
1 Z1 Z2 Z3 Z4 Z5 C1 C2 C3 C4 C5
... etc ...
341 Z1 Z2 Z3 C2 Z4 C1 Z5 C4 C3 C5
... etc ...
ID is an autonumber field. The entries in fields P1 to P10 are the PERMUTATIONS WITHOUT REPEATS of the variables Z1 to Z5 and C1 to C5.
There are 3 rules that govern the order in which values may be selected.
a) Zn precedes Zn+1. Z1 comes before Z2 which comes before Z3...
This rule does NOT apply to the Cn values.
b) Zn must precede Cn
c) Zn cannot be immediately followed by Cn.
The rows shown in the table above comply with these rules. The following row is invalid - in fact it breaks all 3 rules.
(Z3 comes before Z2, C5 precedes Z5, C2 immediately follows Z2)
Z1 Z3 Z2 C2 Z4 C1 C5 C3 C4 Z5
Can this table (or a query would do) be built using SQL?
many thanks
Vicky
I have manually constructed table tblTemplates that has over 300 rows. I'd like to know if SQL could be used to generate this table automatically.
The table looks like this...
ID P1 P2 P3 P4 P5 P6 P7 P8 P9 P10
1 Z1 Z2 Z3 Z4 Z5 C1 C2 C3 C4 C5
... etc ...
341 Z1 Z2 Z3 C2 Z4 C1 Z5 C4 C3 C5
... etc ...
ID is an autonumber field. The entries in fields P1 to P10 are the PERMUTATIONS WITHOUT REPEATS of the variables Z1 to Z5 and C1 to C5.
There are 3 rules that govern the order in which values may be selected.
a) Zn precedes Zn+1. Z1 comes before Z2 which comes before Z3...
This rule does NOT apply to the Cn values.
b) Zn must precede Cn
c) Zn cannot be immediately followed by Cn.
The rows shown in the table above comply with these rules. The following row is invalid - in fact it breaks all 3 rules.
(Z3 comes before Z2, C5 precedes Z5, C2 immediately follows Z2)
Z1 Z3 Z2 C2 Z4 C1 C5 C3 C4 Z5
Can this table (or a query would do) be built using SQL?
many thanks
Vicky