select a.id as id,
       a.warehouse_id as warehouse_id,
       b.customer_id as customer_id, 
       c.supplier_id as supplier_id,
       a.product_category_id as product_category_id,
       a.product_set_id as product_set_id,
       a.product_id as product_id,
       a.price as price,
       1 as currency_type_code,
       NULL as kick_back,
       a.note as note,
       a.created_at as created_at,
       a.updated_at as updated_at
FROM invoice_prices as a
LEFT JOIN warehouses_customers as b on b.warehouse_id=a.warehouse_id
LEFT JOIN product_sets as c on c.id=a.product_set_id
INTO OUTFILE "/tmp/invoice_prices.csv" FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\';
