> 
> > Given a table T like this:
> 
> > A     B
> > ---------
> >  1     5
> >  2     5
> >  3     5
> > 
> > I need a query to give me just the row with the largest A 
> value, within
> > a group defined by B.  In this case, it would be the row with A = 3.
> 
> SELECT MAX(A) AS A , B
> FROM T
> GROUP BY B
> 
> 

Thanks, this does give me the max value of A within a group, but any
remaining column values still come from the row with A = 1.  For example

table T:

 A     B     C
---------------
 1     5     3
 2     5     2
 3     5     1

SELECT MAX(A) AS A, B, C
FROM T
GROUP BY B

gives:

 A     B     C
---------------
 3     5     3

But what I need is:

 A     B     C
---------------
 3     5     1

Reply via email to