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 BY `FieldA`, `FieldB`, `FieldC`, ... ); http://lists.mysql.com/mysql/195820 another way is use shell and get a dump. then replace tab with "," mysql -uuser_name -p database -e "select * from your_table" > PATH/outfile.txt ~Chamila Gayan On Mon, Feb 14, 2011 at 11:15 AM, mos <mo...@fastmail.fm> wrote: > I want to use > > select * into outfile "myfile.txt" from table1; > > and have it export the data as tab delimited but with the column names. I > need the column names because the import utility will use that to create the > table in another (non-MySQL) database. > > As it stands, I can't get the column names to appear. > > Mike > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql?unsub=cgcham...@gmail.com > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org