hello to all
I'm hoping to get help completing a query (qryQ) based on table (tblQ).
Here's tblQ...
ID X0 X1 X2 X3 X4 X5 X6
A A B C F G L N
B A B D E H L M
C A C D E I K N
D B C D F H I O
E B C E F J K M
....
N A C H J M N O
O D F K L M N O
ID runs from A to O. The remaining 7 columns are also filled with values A to O. (I'm aware that the table is not normalized, but I don't think it is necessary here. I could change this if needed.)
I need to construct a query (qryQ) having 4 columns. Typical rows look like...
A B C 13
A C D 13
A D E 15
etc...
a) the first 3 columns show ALL combinations (no repeats, order not important) of 3 values of ID. There will be 455 records.
I've done this with SQL like...
SELECT tblQ_0.ID, tblQ_1.ID, tblQ_2.ID
FROM tblQ AS tblQ_0, tblQ AS tblQ_1, tblQ AS tblQ_2
WHERE (
((tblQ_0.ID)<tblQ_1.ID) And
((tblQ_1.ID)<tblQ_2.ID)
)
ORDER BY tblQ_0.ID, tblQ_1.ID, tblQ_2.ID;
b) HERE'S where I'm having a problem. The 4th column involves a function that outputs an integer value...
A B C 13 means that in records tblQ.ID = A, tblQ.ID = B and tblQ.ID = C, columns x0 to x6 involve 13 DISTINCT values (A, B, C, D, E, F, G, H, I, K, L, M and N. There is no J nor O)
A D E 15 means that records A, D and E have all 15 values (A to O) in columns X0 to X6.
So far I've not been able to write code for this function (in either SQL, if possible, or VBA). Any assistance would be appreciated.
Thank you
Vicky
I'm hoping to get help completing a query (qryQ) based on table (tblQ).
Here's tblQ...
ID X0 X1 X2 X3 X4 X5 X6
A A B C F G L N
B A B D E H L M
C A C D E I K N
D B C D F H I O
E B C E F J K M
....
N A C H J M N O
O D F K L M N O
ID runs from A to O. The remaining 7 columns are also filled with values A to O. (I'm aware that the table is not normalized, but I don't think it is necessary here. I could change this if needed.)
I need to construct a query (qryQ) having 4 columns. Typical rows look like...
A B C 13
A C D 13
A D E 15
etc...
a) the first 3 columns show ALL combinations (no repeats, order not important) of 3 values of ID. There will be 455 records.
I've done this with SQL like...
SELECT tblQ_0.ID, tblQ_1.ID, tblQ_2.ID
FROM tblQ AS tblQ_0, tblQ AS tblQ_1, tblQ AS tblQ_2
WHERE (
((tblQ_0.ID)<tblQ_1.ID) And
((tblQ_1.ID)<tblQ_2.ID)
)
ORDER BY tblQ_0.ID, tblQ_1.ID, tblQ_2.ID;
b) HERE'S where I'm having a problem. The 4th column involves a function that outputs an integer value...
A B C 13 means that in records tblQ.ID = A, tblQ.ID = B and tblQ.ID = C, columns x0 to x6 involve 13 DISTINCT values (A, B, C, D, E, F, G, H, I, K, L, M and N. There is no J nor O)
A D E 15 means that records A, D and E have all 15 values (A to O) in columns X0 to X6.
So far I've not been able to write code for this function (in either SQL, if possible, or VBA). Any assistance would be appreciated.
Thank you
Vicky