Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Help needed: Oracle ans SQL
select A.KEY, A.VALUE, A.LEV from <Your Table> A, (select KEY, max(LEV) F
from <Your table> group by KEY) B
where A.KEY=B.KEY and A.LEV=B.F;
"Mirko Cegledi" <mcegledi_at_itprotect.de> a écrit dans le message news:
3BCBFE9A.B1964A20_at_itprotect.de...
> Hi!
>
> I've got a serious problem:
>
> I've got a table with key/value-pairs and an appropriate level. I'm
> searching for a query which results in a table that lists only the
> key/value-pairs with the greatest level.
>
> Example:
>
> key value level
> ---------------------
> name alice 1
> age 13 1
> name bob 2
> name cindy 3
> gender male 1
> age 15 2
>
> The query should have the following result:
>
> key value level
> ---------------------
> age 15 2
> gender male 2
> name cindy 3
>
> Can anybody help me?
>
> Mirko
Received on Tue Oct 16 2001 - 07:21:04 CDT