请教各位老师,我下面查询的代码,返回了以下结果。我希望对结果再用姓名进行二次分组,只显示张三和李四各只显示一行,后面都是各行的合计,这个要怎么写呢?
select b.id,b.username,sum(c.Repayment) as Repayment,sum(c.yihai) as yihai,(sum(c.Repayment)-sum(c.yihai)) as zonghai from
((agent as a left join member as b on a.id = b.agentid) left join member_detail as c on b.id = c.member_id)
where month(c.createdate) = 11 and a.id =32 group by b.id,b.username,c.createdate