Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: HELP : SQL Question
"Joao Ricardo B. Oliveira" a écrit :
> ...
> I want to get the all row that as the high value(12) in a group by
> clause using only the primary keys id1,id2,id3,id4 and not using the id5.
>
> For instance :
>
> select id1,id2,id3,id4,id5, MAX(value), date
> from table
> group by id1,id2,id3,id4
>
> But this is not valid, because the all columns in the select aren't a
> GROUP BY expression...
>
> ...
May be something like :
select id1, id2, id3, id4, id5, value, date
from table
where (id1, id2, id3 ,id4, value) in (select id1, id2, id3, id4, MAX(value)
from table group by id1,id2,id3,id4)
-- Pierre CHARPENAYReceived on Thu Feb 17 2000 - 00:00:00 CST
![]() |
![]() |