SELECT
	id,
	payable_id,
	NULL as deal_type_code,
	purchase_id as trade_id,
	paying_id as payment_id,
	NULL as carry_id,
	NOW() as created_at,
	NOW() as updated_at
FROM payable_details
INTO OUTFILE "/tmp/payable_details.csv" FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"';