Re: MAX() Function
Posted in 2003
Surely p_bid is some char type. Suggestion: ( I did something like that in Sql-Server... sorry ;) ) Create a stored procedure / funcion that when passing it a char ( a p_bid ) it return the same as an integer for example. So you just change your sql to: select max( to_int(p_bid) ) phonebid from bid where batch = $BATCH into temp t2 with no log; Where to_int is the procedure/function I mentioned; this way you haven't to change the type of p_bid in table bid. Of course if you can afford to change the type of p_bid to some numeric type this is the way to go. Chucho! malcolm.iiug wrote: > p_bid is a character string! If you sort character strings they come out in > that order as well. Why not make p_bid a decimal datatype. After all it is > a number. > > Malcolm > > ----- Original Message ----- > From: "Dave Hill" <dhill@mprc.co.uk> > To: <informix-list@iiug.org> > Sent: Wednesday, August 13, 2003 8:52 AM > Subject: MAX() Function > > > >>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.. > > > sending to informix-list > > -- Atte, Jes's Antonio Santos Giraldo jeansagi@myrealbox.com jeansagi@netscape.net sending to informix-list