Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How do I get one record from a group for a maximum value?
jonathanzta_at_yahoo.com wrote:
> C1(PK) C2 C3 C4
> =====================
> 1 psn-a 10/10/2005 Y
> 3 psn-b 09/09/2009 N
> 5 psn-a 10/10/2006 Y
>
>>From the table above, I want to get columns C2, C3, and C4 for records
Another solution using SQL:1999 OLAP functions:
select c2,c3,c4
from
(
select c2,c3,c4,
row_number() over (partition by c2 order by c3 desc) rn
from tab
) dt
where rn = 1
Dieter Received on Thu Oct 26 2006 - 01:08:10 CDT
![]() |
![]() |