I know that SQL syntax is very powerful, but I am not very proficient in it. To meet your needs, I provide the following reference opinions.
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;
Too lazy