with
    t1 as (
        select
            courier_id,
            sum(delivery_fee) total_delivery_fee
        from
            deliveries_info
        where
            substring(delivery_date, 1, 7) = '2024-07'
        group by
            1
    )
select
    c.courier_id,
    courier_name,
    base_salary + total_delivery_fee total_income
from
    couriers_info c
    join t1 on c.courier_id = t1.courier_id
group by
    1
order by
    1