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