with
t1 as(
select
date_format(t_time,'%Y-%m') as time,
round(sum(t_amount),1) as total
from
trade left join customer on t_cus=c_id
where
c_name='Tom' and date_format(t_time,'%Y')=2023 and t_type=1
group by
time
order by
time
)
select * from t1

京公网安备 11010502036488号