题解 | 物流公司想要分析快递小哥的收入情况

物流公司想要分析快递小哥的收入情况

https://www.nowcoder.com/practice/749ba0168f014c639b516258c0ed6c5d

select
    c.courier_id as courier_id,
    courier_name,
    base_salary + total_fee as total_income
from
    couriers_info as c
    inner join (
        select
            courier_id,
            sum(delivery_fee) as total_fee
        from
            deliveries_info
        where
            substr(delivery_date, 1, 7) = '2024-07'
        group by
            courier_id
    ) as f on c.courier_id = f.courier_id
order by
    courier_id;

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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