题解 | 商品交易(网易校招笔试真题)
商品交易(网易校招笔试真题)
https://www.nowcoder.com/practice/f257dfc1b55e42e19eec004aa3cb4174
题目特点:结果中为一张表分组聚合,另一张表不需要。思路1:子查询+表连接,思路2:group by 多个字段。
select t.goods_id,name,weight,total from( select goods_id,sum(count) total from trans group by goods_id) t join goods g on t.goods_id=g.id where weight<50 and total>20 order by t.goods_id