select id as id,
       charge_customer_id as charge_customer_id,
       charge_customer_group_id as charge_customer_group_id,
       NULL as user_id,
       disp_name as disp_name,
       id as disp_sort,
       j_name as j_name,
       e_name as e_name,
       kana_name as kana_name,
       print_name_1 as print_name_1,
       print_name_2 as print_name_2,
       zip as zip,
       address_1 as address_1,
       address_2 as address_2,
       address_3 as address_3,
       tel as tel,
       fax as fax,
       title_code as title_code,
       NULL as contact_name,
       NULL as delivery_zip,
       NULL as delivery_address_1,
       NULL as delivery_address_2,
       NULL as delivery_address_3,
       NULL as delivery_tel,
       NULL as delivery_fax,
       NULL as attention_name,
       NULL as attention_tel,
       NULL as attention_fax,
       duty_type_code as duty_type_code,
       duty_rate as duty_rate,
       price_duty_type_code as price_duty_type_code,
       CASE duty_calc_type_code WHEN 1 THEN 2 WHEN 2 THEN 1 WHEN 3 THEN 3 WHEN 4 THEN 4 ELSE NULL END as duty_calc_type_code,
       frac_digit_code as frac_digit_code,
       fraction_method_code as fraction_method_code,
       NULL as unit_price_fraction_method_code,
       fraction_method_code as price_fraction_method_code,
       shipping_sheet_type_code as shipping_sheet_type_code,
       sale_sheet_type_code as sale_sheet_type_code,
       charge_sheet_type_code as charge_sheet_type_code,
       NULL as print_stock_date,
       note as note,
       IF(deleted_at is NULL, 0, 1) as invalid_flag_code,
       deleted_at as deleted_at,
       created_at as created_at,
       updated_at as updated_at
FROM customers
INTO OUTFILE "/tmp/customers.csv" FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\';
