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: Ken Denny <ken_at_kendenny.com>
Date: Mon, 08 Oct 2007 07:34:51 -0700
Message-ID: <1191854091.293594.112710@r29g2000hsg.googlegroups.com>


On Oct 5, 10:35 am, sen..._at_gmail.com wrote:
> > select id, name, testdate, marks
> > from students
> > where (id, marks) in
> > (SELECT ID, MAX(MARKS)
> > FROM STUDENTS
> > GROUP BY ID);
>
> Wouldn't this return results from other dates too? though all we are
> looking for is Max(marks) immaterial of date?

Only the date that went with the max(marks). Of course if that same student got that same max mark on two different dates then both of them would show up in the results. Received on Mon Oct 08 2007 - 09:34:51 CDT

Original text of this message

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