Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Max Function Question
For purposes of evaluation let us assume the following:
There is one table called Table1 with three columns a, b, c
populated with the following data
a b c
- - -
1 1 1
1 2 3
2 2 2
2 3 5
My desired resultant record set would be
a b c
- - -
1 2 3
2 3 5
The following function is close to what I need but not quite it. Select a, mac(b) from Table1 group by a;
There is a third column c whose value I wish to include. Select a, c, max(b) from Table1 group by a; Will not work since there is not aggregate function for column c.
Also the following is close but still lacking
Select a, b, c from Table1 where
a in (select a from Table1 group by a) and
b in (select max(b) from Table1 group by a);
Returns:
a b c
- - -
1 2 3
2 2 2 <--Not desired
2 3 5
Hope I have made my needs clear and am thankful for all help
TABates
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Fri Jun 18 1999 - 12:38:32 CDT
![]() |
![]() |