SELECT
	sd.id as id,
	sd.sample_id as sample_id,
	sd.sample_sub_code as seq_number,
	ps.product_category_id as product_category_id,
	sd.product_set_id as product_set_id,
	sd.product_model_id as product_id,
	sd.lot_number as lot_number,
	'' as serial_number,
	sd.ubd_date as ubd,
	24 as validity_period,
	1 as unit_code,
	sd.sample_quantity as quantity,
	NULL as products_price_id,
	sd.sample_type_id as stock_type_code,
	sd.sample_detail_note as note,
	NOW() as created_at,
	NOW() as updated_at
FROM sample_details as sd
LEFT JOIN master_app_production.product_sets as ps
	ON sd.product_set_id = ps.id
INTO OUTFILE "/tmp/sample_details.csv" FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"';