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