Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UPDATE the same field twice in one statement
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01433681
Message ID:
01433701
Vues:
99
This message has been marked as the solution to the initial question of the thread.
>Wouldn't adding a SELECT into the UPDATE slow down the update considerably?

It may or may not

> Why the syntax you posted in your first reply would not work?

Because it's invalid UPDATE statement. Why it conveys the idea, syntactically it's invalid.

>Here is what I was trying to do. I wanted to reduce the value in field MYFLD1 by some calculated value of nValue1 but not to set it below 0. Then I wanted to increase the value in field MYFLD1 by some other calculated value of nValue2.

That's not what your original update statement does. Try
UPDATE mytable SET myfld1 = IIF(myfld1 > nValue1, myfld1 - nValue1, 0) + nValue2 WHERE Pk = nPkValue
You'll have to replace IIF() with CASE in MS SQL Server

> I think maybe you changed the syntax because function MAX() in SQL Server takes only one parameter (is this the case?)?

I don't understand what you're asking and the aggregate MAX() function accept only one parameter in VFP as well.


>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform