Re: MAX() Function
Posted in 2003
Dave Hill wrote: > Hi World, > > Can anybody help and make suggestions why the max function is not > working in my sql? > > select max(p_bid) phonebid > from bid > where batch = $BATCH > into temp t2 with no log; > > What is happening is if a client bids '8 the max function does not > pick up a higher bid until you get to '81!! This is really confusing > me. This is the same no matter if you start with '6 it then wont pick > a bid up as max until '61 etc.. A table schema would be useful, but it sounds like you have defined the p_bid column as a character type instead of a numeric type. You should find that 9 is larger than 8, but 10 is not because the 1 is smaller than the 8. Use a DECIMAL or similar numeric type. Cheers, -- Mark. +----------------------------------------------------------+-----------+ | Mark D. Stock mailto:mdstock@MydasSolutions.com |//////// /| | Mydas Solutions Ltd http://MydasSolutions.com |///// / //| | +-----------------------------------+//// / ///| | |We value your comments, which have |/// / ////| | |been recorded and automatically |// / /////| | |emailed back to us for our records.|/ ////////| +----------------------+-----------------------------------+-----------+ sending to informix-list