Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
This sql query can be short
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01473412
Message ID:
01473426
Views:
28
>>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform