Thursday, November 22, 2007

select statement to csv

Simply put this at the end of your select statement

INTO OUTFILE '/tmp/report.txt'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'