Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Every combination of a list of choices
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01223417
Message ID:
01223564
Vues:
16
Do logical multiplication with SQL-SELECT:
CREATE CURSOR phones (phone C(12))

INSERT INTO phones VALUES ('11111')
INSERT INTO phones VALUES ('22222')
INSERT INTO phones VALUES ('33333')
INSERT INTO phones VALUES ('44444')
INSERT INTO phones VALUES ('55555')
INSERT INTO phones VALUES ('66666')
INSERT INTO phones VALUES ('77777')

SELECT DISTINCT;
	p1.phone, p2.phone, p3.phone, p4.phone, p5.phone,;
	p6.phone, p7.phone;
FROM phones p1, phones p2, phones p3, phones p4, phones p5,;
	phones p6, phones p7;
WHERE p1.phone <> p2.phone;
	AND p2.phone <> p3.phone;
	AND p3.phone <> p4.phone;
	AND p4.phone <> p5.phone;
	AND p5.phone <> p6.phone;
	AND p6.phone <> p7.phone
WHERE clause above is incomplete. Technically it must cover condition "each column value is not equal to any other column value). The way is not optimal. With number of records more than 10 it will freeze any computer for long time.

Also note that
10! = 3,628,800
20! = 2,432,902,008,176,640,000

:)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform