我有一个简单的查询,它从MySQL表中选择列并将其写入csv文件。
(select 'tempid', 'region', 'puma')
union all
select * from (select tempid, region, puma_2000 from tableA order by tempid limit
4000000) a
into outfile 'c:/models/output.csv'
FIELDS TERMINATED BY ','
optionally ENCLOSED BY '"'
LINES TERMINATED BY '\r\n';
它给了我"错误1064.您的SQL语法出错。"。我尝试了一些改动,但似乎没有任何效果。我使用的MySQL版本是5.5。你在查询中看到一个明显的错误吗?
答案 0 :(得分:0)
在行中:
select * from (select tempid, region, puma_2000 from tableA order by tempid, limit
尝试在tempid之后和限制之前删除逗号:
select * from (select tempid, region, puma_2000 from tableA order by tempid limit