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

