Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: max values

Re: max values

From: Keith Gilbert <peggyandkeith_at_worldnet.att.net>
Date: 11 Jan 1999 05:09:21 GMT
Message-ID: <77c121$5qq@bgtnsc02.worldnet.att.net>


It appears as though your code column is not numeric. Thus the first character '9' is interpreted as being the highest value. Try this after changing the code column to a numeric datatype:

Select name, code
from temp
where code = (select max(code) from temp);

Hope this helps.

hpcheong_at_ncs.com.sg wrote in message <776l5d$fd8$1_at_nnrp1.dejanews.com>...
>hi all,
>
>i like to ask about the following.
>
>SQL> select * from temp;
>
>CODE NAME ADDRESS
>---------- ---------- ---------
>12 jane abc
>15 peter qwe
>10 pat poi
>9 leo lkj
>8 eve dfg
>
>when i do a <select max(code) from temp;>, the result is
>
>MAX(CODE)
>----------
>9
>
>instead of 15. what is the correct syntax in order to have 15 to be the
>expected result.
>
>secondly, with the max values got from code, i would want to have the
name's
>result as well which should be peter. what is the syntax? when i do this
><select name, code from temp where name = max(name);>, error is ORA-00934:
>group function is not allowed here. any idea?
>
>could it because oracle 7.2 do not allow such function?
>
>pls help..
>thanks in advance!
>evelyn.
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Sun Jan 10 1999 - 23:09:21 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US