Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with MAX function in SQL statement
Message
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:
01065590
Views:
14
Yeah, I guess I didn't think of that because the first thing I thought of was using IIF in the statement. That worked, but it's ugly. Thanks for the reply.

>Russell,
>
>You can wrap it with a new name.
>
>
>create cursor x1 ( i1 i, i2 i, i3 i, i4 i )
>insert into x1 values ( 1,2,3,4 )
>insert into x1 values ( 2,3,4,5 )
>select vfpmax( i1, i2, i3, i4 ) from x1
>select max( vfpmax( i1, i2, i3, i4 ) ) from x1
>
>function vfpmax( p1, p2, p3, p4 )
>return max( p1, p2, p3, p4 )
>
>
>>Is there a way to use the MAX function in a SQL statement (as opposed to the documented MAX "field function" that calculates the largest value in a column). To be more specific, for any particular record, I need to multiply the value in a field by the value in another field. However, the value in the first field will sometimes be negative 1 and in that case I don't want to multiply negative one by the value in the other field, I want to multiply 0 by the value in the other field.
eCost.com continues to rip people off
Check their rating at ResellerRatings.com
Previous
Reply
Map
View

Click here to load this message in the networking platform