比如A表:
sidsname
1kkkkkkd
2ahuinan
B表
idsmoneysid
11001
22001
31502
希望得到的结果:
sidsnamesmoney
1kkkkkkd300(100+200)
2ahuinan150
参考:
selectA.Sname,sum(B.Smoney)AsSmoney
fromdichan_itemBinnerjoindichan_userA
onB.Suserid=A.id
groupbyB.Suserid,A.Sname
orderbysum(B.Smoney)