select date_format(t_time,'%Y-%m') time,sum(t_amount) total
from customer c left join trade t on c.c_id=t.t_cus
where year(t_time)=2023 and c_name='Tom' and t.t_type=1
group by time
order by date_format(t_time,'%Y-%m')