MySQL > select m.asset_id, M.asset_name, M.director, M.actor, M.country_of_origin, M.years, concat ('/HTTP/ 192.167.1.120:15414/', P.poster_url), m.category from Ao_movie_tab m, Ao_poster_tab p where m.asset_id = p.asset_id Group B Y m.asset_id ORDER by m.asset_id to outfile ' test.txt ' fields terminated by ' \, ';
The fields are separated by commas, and the exported Test.txt file is under the database path
The following reference http://www.cnblogs.com/xh831213/archive/2012/04/10/2439886.html
2. Export Data format
Delimited characters between fields, escape characters, including characters, and record line delimited characters. are listed below:
Fields
TERMINATED by ' \ t ' character delimiter
[Optionally] Enclosed by '
escaped by ' \ \ '
LINES
TERMINATED by ' \ n '
TERMINATED indicates field separation
[Optionally] Enclosed indicates what characters are included in the field.
If optionally is used, only char and Verchar are included escaped to indicate what to use as escape characters when escaping
LINES TERMINATED indicates what separates each row of records
MySQL export to XLS file SQL sample
mysql> mysql bulldog-h1.1.1.1-uroot-p1234-e "select User_id,b.terminal_sn,charge_time,type,money,vmoney from Ao_ Member_charge_tab A, Ao_member_tab b where a.user_id=b.id and A.status=1 and Money > 1.0; ">/bulldog/chongzhi_user_ New.xls
This article comes from "insisting ... "Blog, be sure to keep this provenance http://qchanblog.blog.51cto.com/9686614/1902121
MySQL export file to txt and specify field delimiter; MySQL export to XLS file SQL sample