SELECT(MAX) doesn't work
Posted in 1995
} } ----------------------------------------------------------------- } -- This selcect-statement does NOT match a row } -- because there is no row with hrst = "y" } -- in the temp. table t_lepodemo } ----------------------------------------------------------------- } LET mmtknr = NULL } } SELECT MAX(t_lepodemo.mtknr) } INTO mmtknr } FROM t_lepodemo } WHERE hrst = "y" } } IF STATUS != 0 THEN } error "not availible." } ELSE } display "o.k. mmtknr =", mmtknr } END IF Took me for a ride the first time too. SELECT MAX(whatever) ALWAYS returns properly (unless of course there is some OTHER problem). STATUS will not be set to NOT FOUND. Instead the value you are returned will be NULL. cheers j. _____________________________________________________________________________ Jack Parker yauib* - Hewlett Packard, BSMC Boise, Idaho, USA jparker@hpbs3645.boi.hp.com _____________________________________________________________________________ * yet another unix/informix bigot _____________________________________________________________________________ Any opinions expressed herein are my own and not those of my employers. _____________________________________________________________________________