#第一步: 两表合并,合并待处理的数据 SELECT g.id, g.name, g.weight, t.count FROM goods g LEFT JOIN trans t ON g.id = t.goods_id #第二步:按照商品id汇总数量,注意distinct去重 SELECT DISTINCT id,NAME,weight, SUM(COUNT) over(PARTI...