Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with MAX function in SQL statement
Message
From
04/11/2005 21:04:28
Suchat Soranastaporn
Central office for Healthcare Info
Thailand
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01065034
Message ID:
01065676
Views:
12
It works, but as Sergey pointed out, there is a large performance hit.
It's about 2 - 2.5X in my test comparing Evaluate("max(n1,n2)") to
IIF(n1>n2, n1, n2). :(


>EVAL had crossed my mind, but I didn't try it. I wonder what the performance impact would be. Thanks for your reply.
>
>>Wrap MAX() in evaluate() should work.
>>
>>
>>select round(evaluate("max(0, QtyFld)") * PriceFld, 2) as TotalPriceFld;
>>	from invoice;
>>	into cursor TestCursor
>>
>>But if you want a non-negative Qtyfld, iif(QtyFld>0,Qty,0) might be better.
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform