select
concat('2023-',every_month) time,
sum(t_amount) total
from (
select
substr(t.t_time,6,2) every_month,
t.t_amount
from
trade as t
left join
customer as c
on
t.t_cus = c.c_id
where
t.t_cus = 101
and
year(t.t_time) = '2023'
and
t.t_type = 1
)a
group by
every_month
order by
every_month


京公网安备 11010502036488号