SELECT
	id,
	1 as rev_number,
	NULL as disposal_id,
	input_date,
	disposal_date as target_date,
	35 as user_id,
	19 as section_id,
	hospital_id as warehouse_id,
	1 as supplier_id,
	IF(total_quantity<0, 0, 1) as sign_type_code,
	close_flag_id as state_code,
	disposal_note as note,
	0 as invalid_flag_code,
	NULL as deleted_at,
	NOW() as created_at,
	NOW() as updated_at
FROM disposals
WHERE disposal_date BETWEEN "2011-03-01" AND "2011-03-31"
INTO OUTFILE "/tmp/disposals.csv" FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"';