Is there an easy way to run a MySQL query from the window command line and output the results in CSV format?
Here's what I'm doing now:
mysql -u uid -ppwd -D dbname << EOQ | sed -e 's/ /,/g' | tee list.csv
select id, concat("\"",name,"\"") as name
from students
EOQ
When there are a lot of columns that need to be surrounded by quotes, or if there are quotes in the results that need to be escaped.