题解 | #商品交易(网易校招笔试真题)#
商品交易(网易校招笔试真题)
http://www.nowcoder.com/practice/f257dfc1b55e42e19eec004aa3cb4174
SELECT goods.id, goods.name, goods.weight, sum(trans.count) total
FROM goods JOIN trans
ON goods.id = trans.goods_id
WHERE goods.weight <50
GROUP BY goods.id
HAVING total >20
ORDER BY goods.id;