从 MYSQL 查询中分离导出
我想为表中不同类型的动物创建单独的导出报告。我可以单独编写这些报告,但是我有 200 多种不同的动物类型,因此运行 200 个单独的查询是不切实际的。
ANIMAL_TABLE
AnimalName
-----------
CAT
DOG
MOUSE
HORSE
我基本上想运行一个类似的查询,
SELECT * INTO OUTFILE '/tmp/ANIMAL-NAME.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
ESCAPED BY ‘\\’
LINES TERMINATED BY '\n'
FROM ANIMAL_TABLE WHERE 1
但有 4 个 CSV 文件而不是一个,实际上动物类型的每次更改都会创建一个新文件
CAT.csv
DOG.csv
MOUSE.csv
HORSE.csv
任何帮助将不胜感激。
I would like to create separate exported reports for the different types of animal I have in my table. I can write these reports separately, however I have over 200 different animal types and therefore running 200 separate queries is impractical.
ANIMAL_TABLE
AnimalName
-----------
CAT
DOG
MOUSE
HORSE
I basically would like to run a similar query to
SELECT * INTO OUTFILE '/tmp/ANIMAL-NAME.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
ESCAPED BY ‘\\’
LINES TERMINATED BY '\n'
FROM ANIMAL_TABLE WHERE 1
but have 4 CSV files instead of one, effectively every change in animal type creates a new file
CAT.csv
DOG.csv
MOUSE.csv
HORSE.csv
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)