Tuesday, July 30, 2013

How to output MySQL query results in csv format

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

No comments:

Post a Comment