I want to modify the following code:
SELECT * INTO OUTFILE 'C:\\my_excel_table.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
FROM m开发者_运维技巧ytable;
so that it dumps the result into longtext/variable rather than to a output file.
Not sure if you can, but there is the INSERT ... SELECT FROM
syntax, which lets you insert the results of a select into another table. Problem is that SELECT
is going to return rows, which would be inserted one-by-one into the other table, instead of going in as a single long chunk of text.
use insert select
INSERT INTO mytable (my_field) select my_other_field from my_other_table
精彩评论