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

Home -> Community -> Usenet -> c.d.o.tools -> Re: HELP : SQL Question

Re: HELP : SQL Question

From: Pierre Charpenay <pcharpenay_at_unilog.fr>
Date: 2000/02/17
Message-ID: <38ABEEAA.8B0C80FA@unilog.fr>#1/1

"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 CHARPENAY
Received on Thu Feb 17 2000 - 00:00:00 CST

Original text of this message

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