mysql delimiter question

前端 未结 4 1360
情书的邮戳
情书的邮戳 2020-12-19 12:14

How do i do this:

mysql -u myuser -p mydb -e \"select f1,f2 from  mytable\" > /tmp/mydata.txt

But I want to separate the fields with a c

4条回答
  •  一生所求
    2020-12-19 12:31

    I don't really understand what is the question? Can you explain what you want ?

    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
    

提交回复
热议问题