mysql concat如何将单引号放入

时间:2017-11-10 20:40:43

标签: mysql prepared-statement

我正在尝试将mysql导出到最后一天的表格

set @filepath='C:\\Db\\Dbtest.csv';
select @lastday := date_sub(curdate(),interval 1 day);
SET @datanewname = '_m2_raw_Data';
SELECT @datalasttablename:=concat(@lastday,@datanewname);
SELECT @query:=CONCAT('SELECT *FROM','`',@datalasttablename,'`',' INTO OUTFILE ','''',@filepath,'''');
PREPARE STMT FROM @query;
EXECUTE STMT;

但它无法执行Select * from 2017-11-09_m2_raw_data into outfile'c​​:\ Db \ test.csv'

0 个答案:

没有答案