作者在 2017-10-09 21:58:29 发布以下内容
select u.name_id,u.phone,u.username,sum(i.inmoney)-sum(o.outmoney) as balance
from users u inner join table_in i on u.name_id=i.name_id join table_out o on u.name_id=o.name_id
group by o.name_id,i.name_id ;