Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
This sql query can be short
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01473412
Message ID:
01473426
Vues:
27
>>>i want to this sql query short and speedy for update records.
>>>
>>>UPDATE res SET p01="Fail"  WHERE p01<m01 
>>>UPDATE res SET p01="Pass" WHERE p01>m01 
>>>
>>>UPDATE res SET p02="Fail" WHERE p02<m02 
>>>UPDATE res SET p02="Pass" WHERE p02>m02  
>>>UPDATE res SET p03="Fail" WHERE p03<m03 
>>>UPDATE res SET p03="Pass" WHERE p03>m
>>>......up to  30
>>>
>>
>>Update res 
>>SET po1 = IIF(po1<mo1, "Fail","Pass"), po2 = IIF(po2<mo2, "Fail", "Pass"), etc.
>
>Nomi:
i have also :p01>m01
po1 can be either greater than mo1 or less than mo1 (or equal mo1). So, by writing IIF expression I combine your two conditions.

In other words, the query I wrote, replaces all your 30 queries, although it's not clear what do you want in case of po1 = mo1, etc.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform