select 姓名,cDate as 日期 ,金额
from (
select 姓名,format(日期,'yyyy-mm-dd') as cDate,金额,format(日期,'yyyy-mm-dd') as sdn
from 一张表格
UNION ALL
select '合计' as 姓名,format(日期,'yyyy-mm'),sum(金额),format(日期,'yyyy-mm-99') as sdn
from 一张表格
group by format(日期,'yyyy-mm')
)
order by sdn