2019-03-13
阅读量:
1342
sql 不用group by 怎么求和
问题描述:

对uid 相同的记录的money 求和
比如uid 387 的记录 结果
uid 金额 求和的金额
387 2000.00 5000.00
387 3000.00 5000.00
解决方法:
select a.uid,a.money,c.total_money from (select b.uid,sum(b.money) as total_money from leshi_deal_invest as b group by b.uid) as c
right join leshi_deal_invest as a
on a.uid = c.uid;






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
1条评论