RE: How to export data with column names?

2011-02-14 Thread Jerry Schwartz
-Original Message- From: mos [mailto:mo...@fastmail.fm] Sent: Sunday, February 13, 2011 4:50 PM To: mysql@lists.mysql.com Subject: How to export data with column names? I want to use select * into outfile myfile.txt from table1; and have it export the data as tab delimited but with the

Re: How to export data with column names?

2011-02-13 Thread chamila gayan
you have to use 2 select for do this. The first select generates the headerline and the second the data. ( SELECT 'FieldA','FieldB','FieldC', ... ) UNION ( SELECT `FieldA`, `FieldB`, `FieldC`, ... INTO OUTFILE 'D:/data.csv' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' FROM ... ... GROUP