题解 | #商品交易(网易校招笔试真题)#

商品交易(网易校招笔试真题)

https://www.nowcoder.com/practice/f257dfc1b55e42e19eec004aa3cb4174

#不管是内连接还是左右连接,只要存在重复值,一定是重复连接后返回到新表,也就是说左1,右2,肯定就是1X2

select
distinct goods.id
,goods.name
,goods.weight
,a1.t1 as total
from
goods left join
(
select
*
,sum(count)over(partition by goods_id) as t1
from trans
) as a1
on 
goods.id = a1.goods_id
where a1.t1>=20 and weight<50
order by goods.id


全部评论

相关推荐

双非坐过牢:非佬,可以啊10.28笔试,11.06评估11.11,11.12两面,11.19oc➕offer
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务