Maybe, if you make a file with the SELECT content and call them
from the OS shell, like this:

<example of the content of the my_file>
SELECT table1.a, tabela1.b, table1.c FROM mydatabase.table;

After, call this file from the OS shell:

shell>mysql -A mydatabase < my_file

This will result on the screen. You can direct the result to a file:

shell>mysql -A mydatabase < my_file > my_table.sql

If you need the tabs, do with -t on the options:

shell>mysql -A -t mydatabase < my_file > my_table.sql



-----Original Message-----
From: Ariel Sánchez Mora [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 06, 2006 5:12 PM
To: mysql@lists.mysql.com
Subject: 'Into outfile' doesn't include the column names. How can it be
done?

When using select into outfile, I can only get the table data, but I can't
find how to include the column names. I haven't been able to include the
column names into the actual return of the query, and they don't get stored
in the .csv

Anyone know how to include the column names, table name, other info, as an
actual answer from MySQL? I realize that when I use the command line I can
see the column names, but this is not the case when using, for example,
Delphi, and my real problem, when the outfile is made.

I use SQLyog for exporting to csv and they do include the columns, my bet is
its some SQL option. The manual doesn't specify, at least in the select
syntax part.

Ariel



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to