gpt4 book ai didi

MySQL:将表写入csv文件

转载 作者:行者123 更新时间:2023-11-29 17:55:17 25 4
gpt4 key购买 nike

我有一个简单的查询,它从 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。您在查询中看到明显的错误吗?

最佳答案

行中:

select * from (select tempid, region, puma_2000 from tableA order by tempid,  limit

尝试删除 tempid 之后和 limit 之前的逗号:

select * from (select tempid, region, puma_2000 from tableA order by tempid limit

关于MySQL:将表写入csv文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48909111/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com