Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Help with SQL statement, please!
Hi,
using a subquery should resolve that problem:
select t1.customer, t1.sales
from sales t1
where t1.sales = (
select max(sales)
from sales t2
where t2.customer = t1.customer);
that might still yield duplicates for customers having more than 1 record with equal top sale. If you want to remove these duplicates, you should query select distinct t1.customer,......
regards
Klaus
"Newbie (Joe )" <jranseth_at_hotmail.com> schrieb im Newsbeitrag
news:jg275.334$Hs3.7458_at_news1.mts.net...
> Hello,
> I want to select rows from a table where only one field is
unique...ie:A
> customer may have several purchases, but I want to return only the biggest
> purchases per customer.
> I currently have it returning all purchases for every customer, but
> would like to see only the max value per customer. Here's what I have:
>
> --
>
>
>
Received on Fri Jun 30 2000 - 00:00:00 CDT
![]() |
![]() |