Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UPDATE question
Message
From
20/08/2009 06:58:11
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
UPDATE question
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01419198
Message ID:
01419198
Views:
128
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]
Next
Reply
Map
View

Click here to load this message in the networking platform