select concat(year(t.t_time),case when month(t.t_time) < 10 then '-0' else '-' end,month(t.t_time)) as time,sum(t.t_amount) as total
from trade t join customer c on t.t_cus=c.c_id
where year(t.t_time)='2023' 
and c.c_name='Tom'
and t.t_type=1
group by time
order by time;