select a.客户, a.商品,isnull(b.付款 ,'') as 付款 from 表A a left join ( select x.客户,MIN(x.商品) as 商品,y.付款 from 表A x ,(select 客户,付款 from 表B) y where x.客户=y.客户 group by x.客户,y.付款 ) b on a.客户=b.客户 and a.商品=b.商品
思路 1)每个客户给个序号 2)left join 通过客户+序号
22,209
社区成员
121,730
社区内容
加载中
试试用AI创作助手写篇文章吧