That's very helpful.
--- On Sat, 9/3/11, Tyler Poland <tpoland@stripped> wrote:
From: Tyler Poland <tpoland@stripped>
Subject: Re: select ... into local outfile ... ???
Date: Saturday, September 3, 2011, 3:45 AM
The following closely simulates the default "INTO OUTFILE", you'll have to modify it
slightly for your purposes:
mysql --delimiter=comma -N < select_statement.sql \
| sed 's/\"/\\\"/g' \
| sed 's/\t/\",\"/g' \
| sed 's/$/\"/g' \
| sed 's/^/\"/g' \
| sed 's/\"NULL\"/\\N/g' \
| sed 's/\\t/\t/g' ' > output.txt
*On 9/2/11 3:40 PM, Dennis wrote:
> hi, there,
> the following is my sql statement:
> SELECT HIGH_PRIORITY SQL_BIG_RESULT SQL_NO_CACHE
> tb.url_sign, m_url,
> m_title, m_weight INTO
> OUTFILE '/tmp/a.csv' FIELDS TERMINATED BY ',' ENCLOSED BY
> '\"' LINES TERMINATED BY '\n' STARTING BY '='
> FROM d_local.ta, d_news.tbWHERE ta.url_sign = tb.url_sign
> Before, the server and the client were on the same machine; now, I need to generate
> the output file on client (which is on a different machine from the server). But it seams
> that there is no "select ... into LOCAL file" statement.Any suggestion is appreciated.