Re: FW: SELECT(MAX) doesn't work in a temp. table
Posted in 1995
Charles Francis (ancrcs4!ancrcs4!cfrancis@ancrcs3.attmail.com) wrote: : ---------- : From: cfrancis : To: 'Chcuk Francis' : Subject: RE: SELECT(MAX) doesn't work in a temp. table : Date: Tuesday, March 14, 1995 8:02AM : Here is your answer. Oh yes the code works and yes I rechecked it. Really? Did you try it with data like: f1 i1 == == a -2 a -1 a 0 or f1 i1 == == a 0 b 1 c 2 : My test DB had two fields. : f1 char(1), : i1 integer : when f1 is "a" and i1 is 5 the statement "Cnt = 5" is diplayed. When there : is no record where f1 = "a" the statement "No Record Found" is displayed. : Always keep in mind the data a function returns. Quite. What about the situations where 0 *IS* the maximum??? : Chuck Francis : _________________________________________________________ : database cwf : main : define : cnt integer : let cnt = 0 : select max(i1) into cnt from cwf : where f1 = "a" : if cnt > 0 : then : display "Cnt = ",cnt : else : display "No Record Found" : end if : end main -- graeme -- Disclaimer: The author's opinions are his own, and not necessarily those of Pyramid Technology Ltd. or Pyramid Technology Inc. --------------------------------------------------------------------------- -m------- Graeme Sargent Voice: +44 (0)252 373035 ---mmm----- Senior Database Consultant Fax : +44 (0)252 373135 -----mmmmm--- Pyramid Technology Ltd. Telex: Tell who??? -------mmmmmmm- Farnborough, Hants GU14 7PL Email: graeme@pyra.co.uk --------------------------------------------------------------------------- We have the technology. The tricky bit is learning how to use it.