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: Query HELP : Need ID After Doing "Group By"

Re: Query HELP : Need ID After Doing "Group By"

From: contrapositive <nosp_at_m.com>
Date: Tue, 29 Jan 2002 19:02:54 -0500
Message-ID: <3c573845$1_2@nopics.sjc>


Suggestion 1 here seems to work best. A neat trick. Thanks to all for the responses...

"Thomas Kyte" <tkyte_at_us.oracle.com> wrote in message news:a346tc02j3c_at_drn.newsguy.com...
[...]
> ops$tkyte_at_ORA817DEV.US.ORACLE.COM> select item_class,
> 2 to_number(substr(data,1,10)) version,
> 3 to_number(substr(data,11)) id
> 4 from (
> 5 select item_class, max( to_char(version,'fm0000000009') || id ) data
> 6 from t
> 7 group by item_class
> 8 )
> 9 /
>
> ITE VERSION ID
> --- ---------- ----------
> ABC 1885 3
> PQR 825 5
> XYZ 59 9
>
Received on Tue Jan 29 2002 - 18:02:54 CST

Original text of this message

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