SELECT
	st.id as id,
	wc.customer_id as customer_id,
	st.hospital_id as warehouse_id,
	1 as supplier_id,
	ps.product_category_id as product_category_id,
	st.product_set_id as product_set_id,
	st.product_model_id as product_id,
	st.lot_number as lot_number,
	'' as serial_number,
	st.ubd_date as ubd,
	24 as validity_period,
	1 as unit_code,
	st.existing_quantity as existing_quantity,
	st.available_quantity as available_quantity,
	st.shortly_shipped_quantity as short_shipped_quantity,
	NULL as price,
	NULL as total_price,
	NOW() as created_at,
	NOW() as updated_at
FROM stocks as st
LEFT JOIN master_app_production.product_sets as ps
	ON st.product_set_id = ps.id
LEFT JOIN master_app_production.warehouses_customers as wc
	ON st.hospital_id = wc.warehouse_id
INTO OUTFILE "/tmp/stocks.csv" FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"';