




修正后

SELECT
    `b`.`order_sn` AS `order_sn`,
    `b`.`order_sn_out_trade` AS `order_sn_out_trade`,
    `b`.`service_name` AS `service_name`,
    `b`.`service_no` AS `service_no`,
    `b`.`project_id` AS `project_id`,
    `b`.`project_name` AS `project_name`,
    `b`.`purchase_virt_id` AS `purchase_virt_id`,
    `b`.`purchase_virt_name` AS `purchase_virt_name`,
    `b`.`purchase_user_id` AS `purchase_user_id`,
    `b`.`purchase_user_name` AS `purchase_user_name`,
    `b`.`purchase_phone` AS `purchase_phone`,
    `b`.`sale_id` AS `sale_id`,
    `b`.`sale_name` AS `sale_name`,
    `b`.`amount` AS `amount`,
    `b`.`cost_amount` AS `cost_amount`,
    `b`.`transport_amount` AS `transport_amount`,
    `b`.`complet_state` AS `complet_state`,
    `b`.`accounting_state_supplier` AS `accounting_state_supplier`,
    `b`.`accounting_state_customer` AS `accounting_state_customer`,
    `b`.`pay_type` AS `pay_type`,
    `b`.`pay_state` AS `pay_state`,
    `b`.`order_state` AS `order_state`,
    `b`.`order_state_name` AS `order_state_name`,
    `b`.`settlement_type` AS `settlement_type`,
    `b`.`appraise_state` AS `appraise_state`,
    `b`.`source_channel` AS `source_channel`,
    `b`.`other_params` AS `other_params`,
    `b`.`user_type` AS `user_type`,
    `b`.`user_name` AS `user_name`,
    `b`.`inv_state` AS `inv_state`,
    `b`.`create_time` AS `create_time`,
    `b`.`create_user_id` AS `create_user_id`,
    `b`.`rec_username` AS `rec_username`,
    `b`.`rec_userid` AS `rec_userid`,
    `b`.`rec_userphone` AS `rec_userphone`,
    `b`.`rec_address` AS `rec_address`,
    `b`.`remarks` AS `remarks`,
    `b`.`inv_number` AS `inv_number`,
    `b`.`inv_sn` AS `inv_sn`,
    `a`.`dz_id` AS `dz_id`,
    `a`.`order_id` AS `order_id`,
    `a`.`id` AS `id`,
    `c`.`goods_name` AS `goods_name`,
    `c`.`quantity` AS `quantity`,
    `c`.`price` AS `price`,
    `c`.`goods_params` AS `goods_params`
FROM
    accounting_unified_customer_order `a`
    LEFT JOIN unified_order `b` ON (`a`.`ordersn` = `b`.`order_sn`)
    LEFT JOIN unified_order_goods `c` ON (`b`.`order_sn` = `c`.`order_sn`)
