Answer to problem to MAX usage
Posted in 1995
"Charles Francis" — — source: Informix-list mailing list archive (1991-1998)
My earlier code solution to the problem using MAX did not take into account that MAX might return zero as a valid value from the select. The following code corrects the error. This solution does assume that NULL would NEVER be a valid value for the key field (f1 in code sample). The GROUP BY statement was required syntax by 4gl. Chuck Francis __________________________________________________________ database cwf main define cnt integer, fld char(1) let cnt = 0 let fld = null select max(i1), f1 into cnt, fld from cwf where f1 = "b" group by f1 if fld is not null then display "CNT = ",cnt else display "No Record Found" end if end main