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:
01065100
Views:
16
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.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform