Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
All Combinations of Group Members (challenging)
Message
De
08/09/2005 18:39:51
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
08/09/2005 15:50:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01047849
Message ID:
01047910
Vues:
13
>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

James,
You mean a cartesian join?

ie:
select a.First_name,b.Last_name, c.address ;
  from employee a,employee b, employee c ;
  ORDER BY 1,2,3
PS: If it's that be carefull result set could quickly get into huge sizes:
Result set reccount = reccount(a)*reccount(b)*reccount(c) ... For employee with 3 fields = 15^3

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform