mysql定界符问题 [英] mysql delimiter question
本文介绍了mysql定界符问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我该怎么做:
mysql -u myuser -p mydb -e "select f1,f2 from mytable" > /tmp/mydata.txt
但是我想用逗号分隔字段.
But I want to separate the fields with a comma.
mysql --delimiter=, -u myuser -p mydb -e "select f1,f2 from mytable" > /tmp/mydata.txt
不起作用:(
推荐答案
我真的不明白这是什么问题?你能解释你想要什么吗?
I don't really understand what is the question? Can you explain what you want ?
如果要在输出中添加定界符,则必须使用 CONCAT_WS :
If your wish is to add delimiter to your output, you have to use CONCAT_WS :
mysql -u myuser -p mydb -e "select CONCAT_WS(',',f1,f2) from mytable" > /tmp/mydata.txt
这篇关于mysql定界符问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文