two things
first, this is homework, and i am somewhat dismayed to see courses still being taught
in this millenium using the old-style comma joins
please, use explicit JOIN syntax
second, i'll give you a hint, you have to use a HAVING clause in order to match each salesperson's sales to "the most sales (in dollars) in each sales area" so that only the top salespersons are returned
Code:
SELECT sa.name
, sp.salespersonid
, SUM(s.saleamount) AS Amount
FROM itemsale AS s
INNER
JOIN salesperson AS sp
ON sp.salespersonid = s.salespersonid
INNER
JOIN salesarea AS sa
ON sa.areaid = sp.areaid
WHERE s.saledate >= '2010-01-01'
AND s.saledate <= '2010-06-30'
GROUP
BY sa.name
, sp.salespersonid
HAVING SUM(s.saleamount) =
( SELECT ... )
ORDER
BY sa.name
, sp.salespersonid