user-avatar
Today is Friday
November 1, 2024

Tag: csv

October 6, 2009

import mysql query into csv

by viggy — Categories: Uncategorized — Tags: , , , Leave a comment

When you want to import the results of a query into a csv, you can use the following mysql query.

SELECT a,b,a+b INTO OUTFILE ‘/tmp/result.text’
FIELDS TERMINATED BY ‘,’ OPTIONALLY ENCLOSED BY ‘”‘
LINES TERMINATED BY ‘n’
FROM test_table;