On 29 Oct 2004, at 00:37, Mulley, Nikhil wrote:

How do I dump the data from console to the text file from the output generated by SELECT statement ?

If it's a small answer that you're just trying to save to a file for note-keeping purposes, you could run


 mysql -e 'select * from thing where foo="bar"\G' > outfile.txt

but if you're trying to collect data in a way you can use it, you could run from inside the mysql cli client :

 select * from thing where foo='bar' into outfile 'outfile.txt'

or

select * from thing where foo='bar' into outfile 'outfile.txt' fields terminated by ',' optionally enclosed by '"' lines terminated by '\n';

... if you wanted them to be a CSV file for reading into Excel or otherwise...

--
Regards, Andy Davidson
Geek, Fotoserve.com
http://www.fotoserve.com/


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



Reply via email to