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

某店铺的各商品毛利率及店铺整体毛利率

http://www.nowcoder.com/practice/65de67f666414c0e8f9a34c08d4a8ba6

select '店铺汇总' product_id, concat(round((1 - sum(cntin_price)/sum(cntprice))*100,1),'%') profit_rate from tb_order_detail t_d join tb_product_info t_i on t_d.product_id = t_i.product_id join tb_order_overall t_o on t_d.order_id = t_o.order_id where shop_id = 901 and date(event_time) >= '2021-10-01'

union

select product_id, concat(profit_rate,'%') profit_rate from ( select product_id, ROUND(100 * (1 - SUM(in_pricecnt) / SUM(pricecnt)), 1) profit_rate from ( select t_d.product_id, in_price, price, cnt from tb_order_detail t_d join tb_product_info t_i on t_d.product_id = t_i.product_id join tb_order_overall t_o on t_d.order_id = t_o.order_id where shop_id = 901 and date(event_time) >= '2021-10-01')t1 group by t1.product_id having profit_rate > 24.9 ORDER BY product_id )t2

全部评论

相关推荐

04-17 10:16
门头沟学院 Java
不河狸啊:为什么我的是已送达,连已读都没有
点赞 评论 收藏
分享
头像
04-17 09:29
已编辑
湖南农业大学 后端
睡姿决定发型丫:本硕末9也是0offer,简历挂了挺多,只有淘天 美团 中兴给了面试机会,淘天二面挂,美团一面kpi面,中兴一面感觉也大概率kpi(虽然国企,但一面0技术纯聊天有点离谱吧)
点赞 评论 收藏
分享
MGlory:我当初有一个老师告诉我简历要写的简单,最好只一面,项目可以写核心的,进面了自然会问你的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务