select substr(t_time,1,7) time,sum(t_amount) total
from trade t1 left join customer t2
on t1.t_cus=t2.c_id
where c_name='Tom' and year(t_time)='2023' and t_type='1'
group by time
order by time;