MySQL Forums
Forum List  »  Newbie

Re: Small problem to solve
Posted by: Rick James
Date: April 20, 2016 11:51PM

SELECT `item name`, `qty buy` - `qty sold`
    FROM ( SELECT `item name`, SUM(`qty buy`) AS `qty buy`
               FROM csv1 GROUP BY `qty buy` )
    JOIN ( SELECT `item name`, SUM(`qty sell`) AS `qty sell`
               FROM csv2 GROUP BY `qty sell` )
       USING(`item name`);

However, that is not quite right since it lists only items for which there were both buys and sells. And it does not limit to the year. But maybe it will help you get started.

Options: ReplyQuote


Subject
Written By
Posted
Re: Small problem to solve
April 20, 2016 11:51PM


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.