应该是where sum(t.count) 不对,但不清楚为啥,占个坑,而且开窗了也要去重,你这里为啥用了两边sum,我是这样用的开窗: SELECT g.id,g.name,g.weight,t1.total total from goods as g inner join (SELECT distinct goods_id,sum(count) over(partition by goods_id) total from trans) as t1
点赞

相关推荐

点赞 评论 收藏
分享
牛客网
牛客企业服务