Tuesday, June 14, 2016

MySQL to CSV file



SELECT order_id,product_name,qty
FROM orders
WHERE foo = 'bar'
INTO OUTFILE '/tmp/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';


TODO : There is still to find how to print the column titles along with the result...




No comments:

Post a Comment