>>>I think I should know this but..........
>>>
>>>I have a DB2 table with fields Num1, Num2, Num3 (among others)
>>>
>>>I need to get the largest of the three numeric fields.
>>>
>>>Clearly SELECT MAX(Num1, Num2, Num3) FROM mytable won't work, but it seems as if there ought to be some simple equivalent. I just haven't been able to find it.
>>>
>>>Can somebody point me in the right direction?
>>>
>>>Thanks.........Rich
>>
>>Rich,
>>
>>Try
>>
>>
>>select max(MAX(Num1, Num2, Num3)) from table ...
>>
>
>When using SPT to a DB2 database I get
>"No function with compatible arguements was found."
>
>In VFP-----> SELECT MAX(num1,num2,num3) FROM mytable gives an error "Function name missing )" which seems a strange error. Your syntax produces a result, but it is the MAX for the entire table. I need to find the MAX of the three fields for each record -- the equivalent of the VFP MAX() function rather than the SQL implementation.
Ok, then
select recno(), max(MAX(Num1, Num2, Num3)) from table ... group by 1
Since sql min/max/... cannot be nested, the second max is considered as a normal vfp function
or
select eval('MAX(Num1, Num2, Num3)') from table ...
Gregory