Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UPDATE the same field twice in one statement
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01433681
Message ID:
01433686
Views:
40
The correct (working) way to do that
UPDATE mytable ;
		SET myfld1 = (SELECT MAX(myfld1) FROM mytable WHERE Pk = nPkValue)  - nValue1 + nValue2 ;
	WHERE Pk = nPkValue
>How come I didn't think of that? <g> Thank you very much.
>>You can do it in one update
>>
>>
>>UPDATE MYTABLE SET MYFLD1 = MAX(MYFLD1 - nValue1) + nValue2 WHERE Pk = nPkValue
>>
>>>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform