题解 | #计算商城中2021年每月的GMV#

计算商城中2021年每月的GMV

https://www.nowcoder.com/practice/5005cbf5308249eda1fbf666311753bf

# 已付款订单:status=1
# 未付款的订单:status=0
# gmv:已付款+未付款==status=1and status=0
# where status!=2
select 
date_format(event_time,"%Y-%m") as month,
round(sum(total_amount),1) as 'GMV' 
from tb_order_overall 
where status!=2 and year(event_time)='2021'
group by date_format(event_time,"%Y-%m")
having GMV>100000  
order by GMV

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-03 17:30
点赞 评论 收藏
分享
积极的小学生不要香菜:你才沟通多少,没500不要说难
点赞 评论 收藏
分享
评论
点赞
1
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务