Hãy thử
select cust_fname, cust_lname
from
(select c.cust_fname, c.cust_lname
from customer c join salesorder so on so.so_custid = c.cust_id
join ITEM i on i.item_sonum = so.so_number
group by c.cust_fname, cust_lname
order by sum(i.item_qty) desc)
where rownum = 1
Đây là bản trình diễn sqlfiddle
select cust_fname, cust_lname
from
(select c.cust_fname, c.cust_lname, rank() over (order by sum(i.item_qty) desc) rnk
from customer c join salesorder so on so.so_custid = c.cust_id
join ITEM i on i.item_sonum = so.so_number
group by c.cust_fname, cust_lname
)
where rnk = 1;