PMa
PMa

Reputation: 1771

How can I export MySQL qry results to a CSV or Excel file?

Is there a way I can export the qry results into a csv or excel file?

Upvotes: 1

Views: 191

Answers (1)

Shreyos Adikari
Shreyos Adikari

Reputation: 12754

You can do it by OUTFILE:
Here is an example of storing the result in CSV file.

SELECT * FROM table_name
INTO OUTFILE '/dir/file.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'

Visit here for more details: http://www.tech-recipes.com/rx/1475/save-mysql-query-results-into-a-text-or-csv-file/

Upvotes: 2

Related Questions