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

Home -> Community -> Usenet -> c.d.o.misc -> Re: GROUP BY and ..not a group by expression

Re: GROUP BY and ..not a group by expression

From: <fitzjarrell_at_cox.net>
Date: Fri, 05 Oct 2007 06:05:33 -0700
Message-ID: <1191589533.797787.276270@g4g2000hsf.googlegroups.com>


On Oct 5, 6:35 am, sen..._at_gmail.com wrote:
> > Homework???
>
> NO, dealing with a badly designed set of tables.
>
> > There are meny solutions: subquery with max() and using analytics are
> > just two of them.
>
> Could please you show an example?

You have the working subquery in your first example producing the student id and max marks; you now need to take that and return the data you want:

select id, name, testdate, marks
from students
where (id, marks) in
(SELECT ID, MAX(MARKS)
FROM STUDENTS
GROUP BY ID); David Fitzjarrell Received on Fri Oct 05 2007 - 08:05:33 CDT

Original text of this message

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