SELECT
CONCAT(
"INSERT INTO `channel_bill` (`id`, `apply_no`, `waybill_no`, `bill_type`, `title_type`, `title`, `taxpayer_no`, `email`, `content`, `total_amount`, `address`, `phone`, `bank_name`, `bank_no`, `user_code`, `memo`, `status`, `fail_reson`, `bill_code`, `bill_no`, `url`, `audit_status`, `billing_time`, `service_phone`, `is_delete`, `latest_time`, `record_version`, `created_by`, `creater_time`, `created`, `updated_by`, `updated`) VALUES (",
IFNULL(i.item_id, ''),
",'",
IFNULL(i.apply_no, ''),
"','",
IFNULL(i.waybill_no, ''),
"','",
IFNULL(a.bill_type, ''),
"','",
IFNULL(a.title_type, ''),
"','",
IFNULL(a.title, ''),
"','",
IFNULL(a.taxpayer_no, ''),
"','",
IFNULL(a.email, ''),
"','",
IFNULL(a.content, ''),
"','",
IFNULL(i.total_amount, ''),
"','",
IFNULL(a.address, ''),
"','",
IFNULL(a.phone, ''),
"','",
IFNULL(a.bank_name, ''),
"','",
IFNULL(a.bank_no, ''),
"','",
IFNULL(a.user_code, ''),
"','",
IFNULL(a.memo, ''),
"','",
IFNULL(a. STATUS, ''),
"','",
IFNULL(a.failReson, ''),
"','",
IFNULL(a.bill_code, ''),
"','",
IFNULL(a.bill_no, ''),
"','",
IFNULL(a.url, ''),
"','",
IFNULL(a.audit_status, ''),
"','",
IFNULL(a.billing_time, ''),
"','",
IFNULL(a.service_phone, ''),
"','",
IFNULL(i.is_delete, ''),
"','",
IFNULL(i.latest_time, ''),
"','",
IFNULL(i.record_version, ''),
"','",
IFNULL(i.creater, ''),
"','",
IFNULL(i.creater_time, ''),
"','",
IFNULL(i.creater_time, ''),
"','",
IFNULL(i.modifier, ''),
"','",
IFNULL(i.modifier_time, ''),
"');"
)
FROM
wechat_bill_item i
LEFT JOIN wechat_bill_apply a ON a.apply_no = i.apply_no;