Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UPDATE question
Message
De
20/08/2009 06:58:11
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
UPDATE question
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01419198
Message ID:
01419198
Vues:
127
Hi ,

again, I have a SQL Problem. This time it's an UPDATE:

given
CREATE CURSOR Test(M1 c(1), M2 c(1),n1 I)
INSERT INTO Test Values('A','A',1.1)
INSERT INTO Test Values('A','B',1.2)
INSERT INTO Test Values('B','B',1.3)
INSERT INTO Test Values('A','C',1.4)
INSERT INTO Test Values('C','B',1.5)
INSERT INTO Test Values('C','A',1.6)


CREATE CURSOR Test2(Mx c(1),F1 I)
INSERT INTO Test2 Values('A',1)
INSERT INTO Test2 Values('B',4)
INSERT INTO Test2 Values('C',2)
I like to update Test.n1 with itself*Test2.F1,

Now the problem. F1 is related via Mx to M1 and M2. if M1 !== M2 it should use the higher value of F1
Example
INSERT INTO Test Values('A','A',1.1) && -> n1:= 1.1  : F1(A)=F1(A)=1
INSERT INTO Test Values('A','B',1.2) && -> n1:= 4.2  : F1(A)<F1(B); F1(B)=4
INSERT INTO Test Values('C','B',1.5) && -> n1:= 6.0  : F1(C)<F1(B); F1(B)=4
INSERT INTO Test Values('C','A',1.6) && -> n1:= 3.2  : F1(C)>F1(>); F1(C)=2
any idea how to code this in one UPDATE statement?

TIA
Agnes
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform