select a.id as id,
       a.id as user_id,
       NULL as section_id,
       b.area_id as sales_area_id,
       1 as position_number,
       a.disp_name as disp_name,
       a.id as disp_sort,
       a.j_name as j_name,
       a.e_name as e_name,
       NULL as kana_name,
       a.note as note,
       IF(a.deleted_at is NULL, 0, 1) as invalid_flag_code,
       NULL as deleted_at,
       a.created_at as created_at,
       a.updated_at as updated_at
FROM users as a
LEFT JOIN warehouses as b on b.user_id=a.id
INTO OUTFILE "/tmp/user_positions.csv" FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\';
