You can use the window ( row_number) function to get this result:
select child, MAX_Sale
from (
select child,
sales as MAX_Sale,
row_number() over (partition by parent order by sales desc) as rn
from t
) sub
where rn = 1
... if your table is called t. Replace if necessary.
:
Child | MAX_Sale
---------------+---------
Tunisia | 385
Africa | 81954
All Region | 1000000
South America | 8440
Asia Pacific | 144306
Australia | 9040
Europe | 1440
Argentina | 470
.
, , :
select child,
first_value(sales) over (partition by parent order by sales desc) as MAX_Sale
from t
:
Child | MAX_Sale
--------------+----------
Tunisia | 385
South Africa | 385
Africa | 81954
All Region | 1000000
Africa Region | 1000000
Europe Region | 1000000
America | 1000000
Asia | 1000000
South America | 8440
North America | 8440
Asia Pacific | 144306
Australia | 9040
Pakistan | 9040
Europe | 1440
Argentina | 470
Uruguay | 470
first_value , " ": over .