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