MySQL Forums
Forum List  »  Newbie

Re: mysql sums not working correctly with joins
Posted by: Aimee Molleken
Date: April 30, 2016 03:33PM

The answer that my teacher marked as correct is this:
(SELECT

sales_people.person_id,

sales_people.last_name,

sales_people.first_name,

sales_region.Region_id,

TRIM(sales_region.`name`) AS 'Region Name',

year,
month,
amount_sold


FROM sales

RIGHT OUTER JOIN sales_people_region

ON sales.region_id = sales_people_region.region_id

RIGHT OUTER JOIN sales_region

ON sales_people_region.region_id = sales_region.region_id

RIGHT OUTER JOIN sales_people

ON sales_people_region.person_id = sales_people.person_id

ORDER BY sales_people.person_id, sales_region.region_id ASC, month ASC,amount_sold);

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.