#查询出每个快递员在 2024 年 7 月的总收入(基本工资 + 派送费用总和 )。查询结果按照快递员 ID 升序排列
select t2.courier_id,t2.courier_name,base_salary + fee as total_income
from couriers_info as t1
inner join (
    select a.courier_id,courier_name,sum(delivery_fee) as fee
    from deliveries_info as a
    inner join couriers_info as b
    on a.courier_id = b.courier_id
    where date_format(delivery_date,'%Y%m') = '202407'
    group by a.courier_id,courier_name) as t2
on t1.courier_id = t2.courier_id
order by t2.courier_id