题解 | 获取指定客户每月的消费额


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


全部评论
这题是有点阴湿的
点赞 回复 分享
发布于 01-15 15:46 广东

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务