bq

2024-01-05 12:00

select * from
(select pay_date,sum(pay_num) as pay_num,'合计' as pay_type from pay group by pay_date
union
select pay_date,pay_num,pay_type from pay) a
order by pay_date,pay_type