题解 | 物流公司想要分析快递小哥的薪资构成和绩效情况

物流公司想要分析快递小哥的薪资构成和绩效情况

https://www.nowcoder.com/practice/4be55ba954bf4f928a2d6ff840f23d1b

select c.courier_id,
courier_name,
sum(base_salary+delivery-expense) total_income
from couriers_info c
join (select courier_id,
    sum(delivery_fee) delivery
    from deliveries_info
    where year(delivery_date)=2024 and month(delivery_date)=7
    group by courier_id
) d on c.courier_id=d.courier_id
join (select courier_id,
    sum(expense_amount) expense
    from expenses_info
    where year(expense_date)=2024 and month(expense_date)=7
    group by courier_id
    ) e on c.courier_id=e.courier_id

group by c.courier_id, courier_name
order by c.courier_id

全部评论

相关推荐

飞屋一号:实话实说就行,先争取一下能不能线上,不行就直接放弃,付出与回报不成正比
我的求职进度条
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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