Export usermeta to csv file


I want to export user info along with usermeta to csv file. I havent used usermeta table before so dont know how to fetch results in given sequence :confused: So far my code is as follows:

$select="SELECT meta_value,user_login,user_registered	
FROM wp_usermeta 
INNER JOIN wp_users 
ON 	wp_usermeta.user_id = wp_users.ID 
WHERE meta_key 
IN ('first_name','last_name','email','age','college','city','mobile','accomodation_required','references') 
AND wp_users.user_login != 'admin'"; 

$col=array("FIRST NAME"=>"1","LAST NAME"=>"2","EMAIL"=>"3","AGE"=>"4","COLLEGE"=>"5","CITY"=>"6","MOBILE NO"=>"7","ACCOMODATION REQUIRED"=>"8","REFERENCES"=>"9","USERNAME"=>"10","REGISTERED ON"=>"11");
					echo implode("\	", array_keys($col)) . "\
					$flag = true; 
			array_walk($col, 'cleanData'); 
			echo implode("\	", array_values($r)) . "\