select disc_dept_name as 直达部门,dest_dept_name as 中转部门, sum(amount_freight) as 运费 ,count(amount_freight) as 合计票数 from ta_order_hdr where dest_dept_id > 0 group by dest_dept_name,disc_dept_name order by sum(amount_freight)