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