I kinda have these two (or more) collections or "groups". Each collection has the field names that contain the name and/or address and/or company.
I'm wondering how I loop through these so that I can build a cursor with every possible combination of name+company+address, where there may be one or more of each name, company and address.
I was thinking I could create separate cursors for each name, company, and address and do a full join for each, but how to generically loop through each to obtain every possible combination, even if another group gets added?
Aloha,
James
>When you're saying Name1, Name2, etc. do you really mean FieldName1, FieldName2, etc.?
>
>If yes, you may try something like
>
>select aa.Name1, bb.Address1 from MyTable aa inner join MyTable.bb ;
>on aa.Pk = bb.PK ;
>union all ;
>select aa.Name2, bb.Address1 from MyTable aa inner join MyTable.bb ;
>on aa.Pk = bb.PK ;
>union all ;
>select aa.Name3, bb.Address1 from MyTable aa inner join MyTable.bb ;
>on aa.Pk = bb.PK
>
>etc.
>
>You may construct this statement by looping through aFields...
>
>
>
>
>>Hi All,
>>
>>I'm hoping someone can help me out here.
>>
>>I want to find out how I can generically obtain all the different combinations of group members. The trick is the number of groups is not set and neither is the number of group members.
>>
>>Example:
>>
>>A table has a group of name fields, could be one name, could be three or four names. The same table has a group of addresses, again could be one or two or three.
>>
>>I want to create a cursor that contains one record for each combination of name and address.
>>
>>Record 1: name1+address1
>>Record 2: name2+address1
>>Record 3: name3+address1
>>Record 4: name1+address2
>>Record 5: name2+address2
>>Record 6: name3+address2
>>
>>If it were only name and address that would be alright, however the trick is to get it to work so that another group could be added, say company names and there are more one or more company names as well.
>>
>>In that case the cursor should look something like the following:
>>
>>Record 1: name1+company1+address1
>>Record 2: name2+company1+address1
>>Record 3: name3+company1+address1
>>Record 4: name1+company2+address1
>>Record 5: name2+company2+address1
>>Record 6: name3+company2+address1
>>Record 7: name1+company1+address2
>>Record 8: name2+company1+address2
>>Record 9: name3+company1+address2
>>Record10: name1+company2+address2
>>Record11: name2+company2+address2
>>Record12: name3+company2+address2
>>
>>Aloha,
>>
>>James